如果在有生命中的条件 [英] if condition within animate

查看:126
本文介绍了如果在有生命中的条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用鼠标悬停功能上的folling链接代码
http://困惑。 co.uk/1991_jquery_scroll_tabs_like_browser_tabs.htm

I am using the code from the folling link on mouseover function http://perplexed.co.uk/1991_jquery_scroll_tabs_like_browser_tabs.htm

我在鼠标悬停期间检查偏移值并设置可见性prev和next按钮。但检查总是在下一次鼠标悬停时发生。
例如:当我滚动并到达结尾时,我必须将同一个鼠标悬停期间的下一个按钮设置为不可见。但它发生在下一次鼠标悬停中。

i check the values of offset during mouseover and set the visibility prev and next button. But the checking always happens in the next mouseover . Eg: i have to set the next button to invisible during the same mouse over event when i scroll and reach the end. but it happens in the next mouseover.

在animate函数中编写if函数是否可行

Is it posiible to write an if function within the animate function

推荐答案

不确定是什么问题。我将您使用的脚本从点击更改为鼠标悬停,它只是起作用。无需添加任何if语句。只需更改 .click 部分,如下所示:

Not sure what the problem is. I changed the script you used from 'click' to 'mouseover' and it just works. No need to add any if statement. Just change the .click parts like this:

$(".slider").off('mouseover', '.next').on('mouseover', '.next', function(){
...
}
$(".slider").off('mouseover', '.prev').on('mouseover', '.prev', function(){
...
}

jsFiddle

这篇关于如果在有生命中的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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