WordPress.org

Ready to get started?Download WordPress

Forums

jQuery Smooth Scroll
[resolved] Conflict with Bootstrap tabs (3 posts)

  1. Eliot Akira
    Member
    Posted 10 months ago #

    I love how simple and useful this plugin is. But I noticed that my tabs stopped working - Bootstrap uses anchors to switch between tabs, and somehow this plugin (as well as Easy Smooth Scroll by itself) disables the tabs' anchors.

    Any idea how I could get around this? One way is to filter this plugin out on the page that's using tabs, but then the scroll to top wouldn't show up either..

    http://wordpress.org/plugins/jquery-smooth-scroll/

  2. Eliot Akira
    Member
    Posted 10 months ago #

    OK, I figured out a way to let the plugin not conflict with Bootstrap tabs.

    In the plugin folder, js/jss-script.min.js, I changed this part:

    if(n.href&&n.href.indexOf("#")!=-1

    to be:

    if(n.href&&n.className!='navtab'&&n.href.indexOf("#")!=-1

    Then, for each tab, add the class "navtab" to prevent smooth scroll from blocking it. For example: <a href="#tab-2" data-toggle="tab" class="navtab">

    Another thing I noticed was that Bootstrap carousel also uses anchors, and this smooth scroll plugin blocks them. To prevent that, change the above part of jss-script.min.js to be:

    if(n.href&&n.className!='navtab'&&n.className!='right carousel-control'&&n.className!='left carousel-control'&&n.href.indexOf("#")!=-1

    There might be a better way to do this, but for now it's a working fix.

  3. ndsailor
    Member
    Posted 8 months ago #

    Thanks for the lead... I seem to have come up with a slightly simpler method that doesn't require any additional changes to bootstrap tab set-up.

    Just get more specific with the .indexOf("#")!=-1 to a <div> with a specific ID at the top of the page. In my case it was .indexOf("#header_full")!=-1

    I also edited the display_link function in the main php file, but it seemed to work even without that edit.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.