我有一个精灵,我想移动使用jQuery另一个div的滚动位置的onClick图像请帮助移动精灵位置与jQuery
.top-background{
background: url("../images/mainall.jpg") no-repeat scroll 0px 0px transparent;
height: 888px;
width:1024px;
}
我有一个精灵,我想移动使用jQuery另一个div的滚动位置的onClick图像请帮助移动精灵位置与jQuery
.top-background{
background: url("../images/mainall.jpg") no-repeat scroll 0px 0px transparent;
height: 888px;
width:1024px;
}
$("#divToClick").click(function(){
$("#yourElementId").scrollTo(//location where to scroll);
});
这里是demo
希望它有助于
你可以看到它在早期问题 About sprites
,它是关于重新精灵教程.. CSS sprite
如果妳想要使用jQuery做到这一点:
$('.top-background').css('background-position', 'position_to_show_next_image');
与事件方法悬停或你有什么想做的事,将其固定..
如果您尝试滚动图像背景,这可能对您有所帮助。 - http://youlove.us/blog/the-youloveus-scrolling-background-effect-explained
http://plugins.jquery.com/project/ScrollTo – Rafay 2011-02-04 05:17:57