我有一個精靈,我想移動使用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