javascript - 可以计算切换吗?

标签 javascript jquery html css

我很好奇,是否可以计算切换次数?因为我有一个问题,当我将它悬停并多次悬停并选择其中一项时,该按钮将推到底部并且看不到。或者这是解决此问题的另一种方法?

已更新

即使我将鼠标悬停并悬停并再次悬停也不会多次它也会推到底部。

click here for js fiddle

JS

        $("#popup_survey_whitebox").hover(function () {
        $('#popup_survey_whitebox_content').stop().animate({
            opacity: 1,
            height: "toggle"
        }, 500, function () {
            $("label#popup_survey_label_title").text(orig); // Here put the original text.

        }).css('position', 'relative');

    }, function () {
        $('#popup_survey_whitebox_content').stop().animate({
            opacity: 1,
            height: "toggle"
        }, 500, function () {
            $("label#popup_survey_label_title").text(newText); // Here put the new text with "..."

        }).css('position', 'relative');
    });

enter image description here

enter image description here

最佳答案

最后我找到了解决这个问题的方法。

      $("#popup_survey_whitebox").hover(function () {
    $('#popup_survey_whitebox_content').finish().animate({
        opacity: 1,
        height: "toggle"
    }, 500, function () {
        $("label#popup_survey_label_title").text(orig); // Here put the original text.

    }).css('position', 'relative');

}, function () {
    $('#popup_survey_whitebox_content').finish().animate({
        opacity: 1,
        height: "toggle"
    }, 500, function () {
        $("label#popup_survey_label_title").text(newText); // Here put the new text with "..."

    }).css('position', 'relative');
});

将两个动画的 $('#popup_survey_whitebox_content').stop() 更改为 $('#popup_survey_whitebox_content').finish()

关于javascript - 可以计算切换吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27812127/

相关文章:

javascript - 引用外部 JavaScript 模板

javascript - 修改uniform值时为什么要先使用get Uniform

javascript/jquery-如何检查元素是否具有文本属性

javascript - 如何使用 jQuery 在单击事件上选择下一个 ul

javascript - 检查输入中的值-Google Maps自动完成

javascript - AppleScript (Javascript) : Remove class, 如果

javascript - V8 GC何时触发其第一个次要GC周期(清理)?

html - 我想使用 html 在表格的每一行旁边添加一个复选框

向下滚动时 JavaScript 菜单隐藏,停止时出现

html - 是否可以使用 CSS(不使用图像)执行此 "half strikethrough"