jquery - setting image visible area in css -
i using jcarousel make image slider of logos. in image should not used background should in image tag, thats requirement. placed images in li tag. , jcarousel working fine.
but here have show half of picture(sprite image [default,mouse on image]) default , on mouse on part. in css how set image position show half of picture , on mouse on half.
see screenshot.
thanks
first, make sure li elements set overflow: hidden.
then, move img's left, outside of li elements:
var neg_width_of_individual_img = -35; //may need change number! $(document).ready(function(){ $('#slideshow img').hover( function(){ $(this).css('margin-left',neg_width_of_individual_img); }, function () { $(this).css('margin-left',0); } ); });
Comments
Post a Comment