nckprsn / scrollme

A jQuery plugin for adding simple scrolling effects to web pages.
1.47k stars 318 forks source link

not working in bootstrap tab #31

Open Phe0nix opened 8 years ago

Phe0nix commented 8 years ago

scrollme not working in bootstrap tab..means in one tab it's working fine but when i click the another tab then animation is not working..need help

joeyfromspace commented 8 years ago

It's likely because Bootstrap's tab class sets display:none on inactive tabs, which are not polled by jQuery event listeners.

You'll have to reinitialize scrollme whenever a tab changes. Judging from the scrollme code, the below should work using Bootstrap's shown.bs.tab event (more about events at the Bootstrap site:

$(document).ready(function() {
  $('a[data-toggle="tab"]').on('shown.bs.tab', function () {
    scrollme.init();
  });
});

As an aside, I don't see any code in scrollme that disconnects old event listeners. It should be fine in normal use, but having scrollme reinitialize hundreds of times between page loads may result in weird behavior or memory leaks.

Phe0nix commented 8 years ago

it's also works fine for me..only problem is that BS tab..when i click to the another tab all the animations are gone..

joeyfromspace commented 8 years ago

I don't think there is a quick or simple way to get the state to persist. Not with scrollme anyway. Have you looked at skrollr or ScrollMagic? They're a bit more complex, but might be a better fit for your use case.

Phe0nix commented 8 years ago

i need it very quick if possible..is there anyway solving this problem with scrollme..