簡體   English   中英

移動設備和平板電腦的Mouseenter和mouseleave更改

[英]Mouseenter and mouseleave change for mobile and tablet

如何將mouseenter和mouseleave更改為可以使用click? 我有圖像,然后單擊顯示另一個內部。 如何修復mouseleave,這是Javascript中的代碼:

$("div.mitarbeiterfoto")
    .mouseenter(function() { 
            var id = $(this).attr("id");
            var idInfo = $(this).attr("id").substr(5);
            ($(this).find('img').css('display', 'none'));
            ($('#' + id + '_o').css('display', 'block'));
            showInfo(idInfo);
    })

    .mouseleave(function() {
            var id = $(this).attr("id");
            var idInfo = $(this).attr("id").substr(5);
            ($(this).find('img').css('display', 'block'));
            ($('#' + id + '_o').css('display', 'none'));
            hideInfo(idInfo);
    });

請我需要幫助!

分配這樣的事件將起作用

$('.mitarbeiterfoto').on('mouseenter', function () {
       var id = $(this).attr("id");
            var idInfo = $(this).attr("id").substr(5);
            ($(this).find('img').css('display', 'none'));
            ($('#' + id + '_o').css('display', 'block'));
            showInfo(idInfo);
});

$('.mitarbeiterfoto').on('mouseleave', function () {
       var id = $(this).attr("id");
        var idInfo = $(this).attr("id").substr(5);
        ($(this).find('img').css('display', 'block'));
        ($('#' + id + '_o').css('display', 'none'));
        hideInfo(idInfo);
});


$('.mitarbeiterfoto').on('click', function () {
    //click
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM