Web Kit 转换左功能不起作用 - 解决小提琴问题
我在 webkit 转换中的position:relative 元素上遇到了巨大的麻烦,无法将其移动到左侧。它应该有效,但没有。通过 jQuery 添加一个类,然后该类应该会生效。
<div id="reviews">
<div id="dropout">Blast</div>
<a href="#" onclick="dropout(); return false">move it</a>
</div>
#reviews #dropout {
position:relative;
min-height:40px;
left:40px;
-webkit-transition: left 600ms;
-moz-transition: left 600ms;
}
#reviews .dropopen {
min-height:40px;
left:0px;
-webkit-transition: left 600ms;
-moz-transition: left 600ms;
}
function dropout() {
$('#dropout').addClass('dropopen');
}
也许小提琴可能会有所帮助 http://jsfiddle.net/4WmJz/1/
有什么想法吗?
奇妙
I'm having enormous trouble with the position:relative element in webkit transition to move it to the left. It should work but does not. A class is added via jQuery that should then take effect.
<div id="reviews">
<div id="dropout">Blast</div>
<a href="#" onclick="dropout(); return false">move it</a>
</div>
#reviews #dropout {
position:relative;
min-height:40px;
left:40px;
-webkit-transition: left 600ms;
-moz-transition: left 600ms;
}
#reviews .dropopen {
min-height:40px;
left:0px;
-webkit-transition: left 600ms;
-moz-transition: left 600ms;
}
function dropout() {
$('#dropout').addClass('dropopen');
}
Perhaps a Fiddle might help http://jsfiddle.net/4WmJz/1/
Any ideas?
Marvellous
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已解决! (我希望)
有几个问题。首先,
onclick()
函数未正确绑定,jQuery 未加载到 jsFiddle 页面上,最重要的是,选择器的特殊性是错误的。基本上,#id #id
选择器比#id .class
具有更高的特异性,因此即使将类正确添加到元素,也不会应用属性。编辑另一个链接到精彩可视化的机会CSS 特异性。
Solved! (I hope)
There were a couple of problems. Firstly the
onclick()
function was not bound correctly, jQuery was not loaded on the jsFiddle page and most importantly, the specificity of your selectors was wrong. Basically#id #id
selector has a greater specificity than#id .class
, so even if the class was correctly added to the element, the properties would not be applied.Edit Another occasion to link to a great visualization of CSS specificity.