1

我正在尝试使用 jQuery 在菜单页面中连接一些简单的鼠标事件。它在 Chrome 和 IE9 中运行良好,但在 Safari 中,当我移动鼠标时,突出显示会卡在某些元素上。这是显示页面的 3 个浏览器。您将不得不想象这一点,因为我不允许发布屏幕截图的链接。对不起。

这是连接事件的代码:

$(document).ready(function() {

    $("#number").focus();

    // We use td elements instead of anchors as the menu items. The ones we want to work with all have 
    // a custom attribute called url that stores the url template...
    var linkCells = $("td[url]");

    // Wire up the click handler for each link cell...
    linkCells.click(function () {
        Navigate($(this).attr('url'));
    });

    // Wire up mouse events for the link cells. We want to highlight the current cell and update
    // the number label...
    linkCells.bind('mouseenter mouseleave', function(e) {
        var linkCell = $(this);
        linkCell.toggleClass('linkOn');
        if(e.type == 'mouseenter') {
            $("#numberLabel").html('<b>' + linkCell.attr('numberLabel') + '</b>');
        }
    });

    // Wire up the submit event in case the user presses the Enter key instead of clicking a link...
    $("#Form1").submit(function() {
        Navigate($("#lastLink").val());
        return false;
    });
});

是否有任何特殊技巧可以使 Safari 的行为与其他浏览器相同?

谢谢,

马修麦克法兰

4

0 回答 0