jQuery UI non ajax tab loading whole website into itself?

前端 未结 7 1724
灰色年华
灰色年华 2021-02-07 03:00

Having a large problem with jQuery Tabs.

Im trying to load the tabs on my sites product page... When the page loads i see that tabs content for a second (standard html t

7条回答
  •  情话喂你
    2021-02-07 03:45

    Messing with base attribute just to make tabs working. It's too much

    Another hacky workaround:

    element.tabs({
      create: function(event, ui){
        var tabsData = $(event.target).data('ui-tabs');
        tabsData.anchors.each(function(idx, anchor){
          var contentId = $(anchor).attr('href');
          var $panel = $(tabsData.panels[idx]);
          $panel.html($(contentId).remove().html());
        });
      },
      beforeLoad: function(event, ui){
        event.preventDefault();
      }
    });

    tested with jQuery UI - v1.11.1

提交回复
热议问题