jQuery的CSS背景位置动画 [英] jQuery css background-position animation

查看:199
本文介绍了jQuery的CSS背景位置动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

结果
我有与jQuery和CSS一个奇怪的问题;似乎一个jQuery的bug;我试着搜索周围,但相关信息是丑陋的。结果
有一张大照片作为身体的背景;当我点击一个按钮,我想获得背景的简单的jQuery动画,从自下而上的位置为50%的位置。结果
好吧,如果我设置 $(机构),CSS(背景位置,中心50%); 它的工作原理,但如果我尝试涂用动画() jQuery函数它不工作了。结果
那么,有可能有在某种程度上这种效果呢?结果
非常感谢你提前。


I've got a strange problem with jQuery and CSS; it seems a jQuery bug; I've tried to search around but infos are ugly.
There's a large photo as background of the body; when I click on a button I wish to obtain a simple jQuery animation of the background, from "bottom" position to "50%" position.
Well, if I set $("body").css("background-position", "center 50%"); it works but if I try tu use animate() jQuery function it doesn't works anymore.
So is it possible to have this effect in some way?
Thank you so much in advance.

推荐答案

我是pretty确保它不是可以使用动画()为相对值,因为它不是轻易可以从相关信息计算绝对位置。

I'm pretty sure it's not possible to use animate() for relative values, because it's not easily possible to calculate absolute positions from the relative information.

尝试使用像素值的所有道路。

Try using pixel values all the way.

这篇关于jQuery的CSS背景位置动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆