A
A
AGGRESS0R2016-04-06 16:15:48
JavaScript
AGGRESS0R, 2016-04-06 16:15:48

bootsrap3 tabs. How to show animation before switching to new tab?

Situation - we have standard bootstrap-3 tabs.
When scrolling the page, they stick to the top edge and are always available. When switching to another tab, it scrolls to the top of the page using jQuery animate (so that the content of the new tab is read from the beginning).
But scrolling happens at the same time as switching tabs. How can I make the scrolling animation execute first, and only then a new tab is displayed?
I tried experimenting with tab events (show.bs.tab, hide.bs.tab, etc.), but nothing worked.
The original file cannot be modified (bootstrap.min.js)
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
entermix, 2016-04-06
@entermix

After clicking on the tab, first make the animation, and then open it like this:
getbootstrap.com/javascript/#tabs
Something like this:

$('#myTabs').click(function ()
$("div").animate({
      complete: function(){
          $('#myTabs').tab('show')
     }
    }, "slow");
})

Or like this:
$('#myTabs a').click(function (e) {
  e.preventDefault() // Запрещаем выполнять действие по умолчанию
// Делаем анимацию
  $(this).tab('show') // Показываем вкладку
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question