jquery中的动画问题
我试图将一个动画添加到有效的类中,但根本不起作用,因为我有一个属性没有设置,我知道为什么要检查它。
$(document).ready(initialize);
function initialize() {
$(".imagePanel").hover(mouseOver,mouseOut);
}
function mouseOver() {
$(this).animate({
border:"2px"
opacity: 0.25
}, 100);
}
function mouseOut() {
$(this).animate({
border: "2px",
opacity: 0.25
}, 100);
}
问题首先是它没有设置属性边框,其次是不知道如何删除鼠标移出功能中的不透明度。边框设置为 div
元素。谢谢。
i'm trying to put an anitmation to class that works, but no at all because i have one property that's doesn't setting and i know why check this.
$(document).ready(initialize);
function initialize() {
$(".imagePanel").hover(mouseOver,mouseOut);
}
function mouseOver() {
$(this).animate({
border:"2px"
opacity: 0.25
}, 100);
}
function mouseOut() {
$(this).animate({
border: "2px",
opacity: 0.25
}, 100);
}
the problem it's first that the property border it's not setting and second that don't have any idea about to remove the opacity in the function mouse out. The borders are setting to a div
element. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您似乎无法在
animate
中设置边框,但可以使用css
:参见示例 →
It doesn't seem that you can set the border within
animate
, but you can withcss
:See example →
尝试一下。
http://jsfiddle.net/n2ugx/8/
Try that.
http://jsfiddle.net/n2ugx/8/
我不确定您的问题是否足够清楚,但您的代码中存在问题。
mouseOut() 和 mouseOver() 函数是相同的。什么都不会发生。
jQuery animate() 使元素从其开始处进入指定的最终状态。您的两个功能都是相同的,因此没有任何变化。
I'm not sure your question is clear enough but there are problems in your code.
Both mouseOut() and mouseOver() functions are identical. Nothing will happen.
jQuery animate() takes the element to your specified final state from wherever it starts. Both of your functions are the same so nothing changes.