Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

youlichika

macrumors member
Original poster
Aug 27, 2010
35
0
I need a jqeury animate effection. when I click img1.jpg, img2.jpg will animate right 200px, but I have too many divs and other html elements, I tried many times, it also failed. How to write correctly? Thanks. PS: h1, the font is on the top of image, and b class="effect" is some fadein effect, it should be the toppest of the all.
Code:
<script type="text/javascript">  
jQuery(".font1").click(function(){ 
  jQuery(".div21").animate({"right": "+=200px"}, "slow"); 
}); 
</script> 
<a href="#" class="click"> 
<div class="div11" style="float:left;"> 
<h1 class="font1" style="z-index:5;">text1</h1> 
<div class="div12"> 
<div class="div13">  
<img src="img1.jpg"> 
<b class="effect" style="z-index:10;"></b> 
</div> 
</div> 
</div> 
</a> 
<a href="#" class="click"> 
<div class="div21" style="float:right;"> 
<h1 class="font2" style="z-index:5;">text2</h1> 
<div class="div22"> 
<div class="div23"> 
<img src="img2.jpg"> 
<b class="effect" style="z-index:10;"></b> 
</div> 
</div> 
</div>
 
Can you post the rest of your code? Or provide a link to it?

Also, I am not sure what you mean "I have too many divs". If you feel you have unnecessary divs, why don't you work on eliminating those?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.