开发者社区> 问答> 正文

如何让一个图片的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 2000 0
1 条回答
写回答
取消 提交回答
  • $('xxx').css('background-position-x', '100px');

    2019-07-17 19:19:09
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载