Preventing scroll when using URI hash to identify tab

前端 未结 8 1838
陌清茗
陌清茗 2020-12-11 16:05

I\'m using JQuery UI to make tabs in my application. I needed the tabs to be linkable (direct link that opens the page and selects the correct tab). This is done by using a

8条回答
  •  粉色の甜心
    2020-12-11 16:27

    This simple method worked for me:

    /* Prevent scroll to tab on click */
    $(document).ready(function(){
      $("a.ui-tabs-anchor").click(function(e){
          e.preventDefault();
          return false;
      });
    });
    

提交回复
热议问题