开发者社区 问答 正文

如何让一个图片的background-position横坐标加一个值?

雪碧图x=0 时是点击前的样式, x=100px 时是点击后的样式,
点击前

img1

background: url("../images/images.png") no-repeat scroll 0 -94px;
img2

background: url("../images/images.png") no-repeat scroll 0 -188px;
img3

    background: url("../images/images.png") no-repeat scroll 0 -282px;
点击后

img1, img2,img3分别是

background: url("../images/images2.png") no-repeat scroll 100px -94px;

background: url("../images/images.png") no-repeat scroll 100px -188px;

background: url("../images/images.png") no-repeat scroll 100px -282px;

展开
收起
小旋风柴进 2016-05-30 10:08:53 2103 分享 版权
1 条回答
写回答
取消 提交回答
  • $('xxx').css('background-position-x', '100px');

    2019-07-17 19:19:09
    赞同 展开评论
问答地址: