css 'pointer-events' property alternative for IE

前端 未结 12 1393
無奈伤痛
無奈伤痛 2020-11-22 02:45

I have a drop down navigation menu in which some of the title should not navigate to other page when clicked(these title open a drop down menu when clicked on) while others

12条回答
  •  时光取名叫无心
    2020-11-22 03:42

    I've found another solution to solve this problem. I use jQuery to set the href-attribute to javascript:; (not ' ', or the browser will reload the page) if the browser window width is greater than 1'000px. You need to add an ID to your link. Here's what I'm doing:

    // get current browser width
    var width = $(window).width();
    if (width >= 1001) {
    
        // refer link to nothing
        $("a#linkID").attr('href', 'javascript:;'); 
    }
    

    Maybe it's useful for you.

提交回复
热议问题