2

我有一个脚本可以隐藏标题标签。这在使用 mixitup 插件的初始页面加载时效果很好。但是,如果我使用排序功能,脚本将停止工作并显示标题标签。

我想运行这个函数,即使在混合排序完成之后。以下是脚本,我用来在鼠标悬停时隐藏标题标签。

<script type="text/javascript">

 $(document).ready(function(){
    $( "a" )
        .mouseenter(function() {    
            var title = $(this).attr("title");
            $(this).attr("tmp_title", title);
            $(this).attr("title","");
        })
        .mouseleave(function() {
            var title = $(this).attr("tmp_title");
            $(this).attr("title", title);
        })
        .click(function() { 
            var title = $(this).attr("tmp_title");
            $(this).attr("title", title);
        });
    });
     </script>

请帮我解决这个问题。

4

1 回答 1

0

我认为您的事件已被您的排序删除。这应该有效:

$(document).ready(function (){
    $(document).on({
        mouseenter: function () {    
            var title = $(this).attr("title");
            $(this).attr("tmp_title", title);
            $(this).attr("title","");
        },
        mouseleave: function () {
            var title = $(this).attr("tmp_title");
            $(this).attr("title", title);
        },
        click: function() { 
            var title = $(this).attr("tmp_title");
            $(this).attr("title", title);
        }
    }, "a");
});
于 2016-08-14T20:41:30.807 回答