1

I have an image that is a sprite, I want to move the scroll location onClick of another div with jquery please help

.top-background{
    background: url("../images/mainall.jpg") no-repeat scroll 0px 0px transparent;
    height: 888px;
    width:1024px;
}
user229044
  • 232,980
  • 40
  • 330
  • 338
ChrisNoob
  • 13
  • 3

3 Answers3

1

You can see it in earlier question About sprites

and it is tutorial about sprite again.. CSS sprite

If u want to do it with jquery :

 $('.top-background').css('background-position', 'position_to_show_next_image');

and attach it with event method hover or what do you want to do..

Community
  • 1
  • 1
Joko Wandiro
  • 1,957
  • 1
  • 18
  • 28
1

This might be helpful to you if you are trying to scroll an image background. - http://youlove.us/blog/the-youloveus-scrolling-background-effect-explained

Jo Albright
  • 560
  • 1
  • 5
  • 14
0
$("#divToClick").click(function(){
  $("#yourElementId").scrollTo(//location where to scroll);

});

here is the demo

hope it helps

Rafay
  • 30,950
  • 5
  • 68
  • 101