jQuery collapsing faded divs and expanding animation problem -


i'm trying animate image full width , height of div works top left image i'd expect others moves image top left , animates it

here's link jsfiddle

is there way fade siblings out , animate image current position?

thanks

solution

to desired effect works in browsers did jsfiddle

thanks iwasrobbed helping solution

it possible, not fadein or fadeout functions. instead, have animate opacity on absolutely positioned elements. if try , use fadein or fadeout nothing.

here jfiddle version jquery 1.5.0 works (added orbling's images firefox users can't see broken image symbol): http://jsfiddle.net/iwasrobbed/qpkr5/1/

<!doctype html> <html> <style media="screen" type="text/css">     /* positioning */     img.topleft {position: absolute; top: 0; left: 0;}     img.topright {position: absolute; top: 0; right: 0;}     img.bottomleft {position: absolute; bottom: 0; left: 0;}     img.bottomright {position: absolute; bottom: 0; right: 0;}      /* element dimensions */     div.work {background-color: #ddd; height:240px; position: relative; width:300px;}     img {width:150px; height:120px; border:none;} </style> <body> <div class="work">     <a href="#"><img class="topleft" src="http://i.stack.imgur.com/jqfbb.jpg" /></a>     <a href="#"><img class="topright" src="http://i.stack.imgur.com/l5ops.jpg" /></a>     <a href="#"><img class="bottomleft" src="http://i.stack.imgur.com/okxqz.jpg" /></a>     <a href="#"><img class="bottomright" src="http://i.stack.imgur.com/4uphw.jpg" /></a> </div> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){     // prevent click jump     $('a').click(function() {     return false;     });      // work     $('img').hover(     function(){         console.log( "mouseenter" );         var $that = $(this);         $(this).parent().siblings('a').animate({opacity: 0},function() {             $that.animate({                 width: "300px",                 height: "240px"             });         });     },     function(){         console.log( "mouseleave" );         var $that = $(this);         $(this).animate({             width: "150px",             height: "120px"         }, 1500, function () {             $that.parent().siblings('a').animate({opacity: 1});         });     }); }); </script> </body> </html> 

Comments

Popular posts from this blog

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

apache - Add omitted ? to URLs -

php - How can I stop spam on my custom forum/blog? -