Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Bootstrap Toggle Doesn't Re-Collapse

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #207607
    Kevin Mamaqi
    Participant

    I’m trying to fix the toggle button from the mobile view in my theme, it doesn’t re-collapse. I guess it should be a CSS error because the Javascript console doesn’t throw any error.

    Website: http://www.wildlionrecords.com/tours/

    #207609
    Atelierbram
    Participant

    Not a CSS issue, somehow the in class isn’t removed from the #navbar when hitting the button again, so it is javascript. Has to be something else then Bootstrap also, for that is working fine in this reduced test case with just the default bootstrap.js. What I would do is:

    1. Make a static copy of the site (view source > copy), or fork the Codepen I made
    2. Now start adding other javascript currently going on, and see when it breaks the behaviour
    3. the last script added should be the one causing the error

    Looking at the source code, it seems there is also some scripts added in twice.

    #207610
    Paulie_D
    Member

    Moved to JS Section

    #207707
    Kevin Mamaqi
    Participant

    Thank you @Atelierbram, it was caused because jQuery was loading two times but I didn’t know why, so I used this plugin (https://wordpress.org/plugins/wp-jquery-plus/) to load it from Google CDN and now it is working fine.

    #207708
    Atelierbram
    Participant

    It had to be something like that, anyway, If I am not mistaken I think it’s expected from WordPress plugin authors to use (“enqueue”) the version of jQuery that comes with WordPress.

    There is also this Minqueque plugin that is supposed to be good, but haven’t had a chance to try out yet. When using that one for all the (conditional) loading of scripts, you maybe don’t need that other “WP-jQuery-Plus” plugin. Just a thought …

    #207711
    Kevin Mamaqi
    Participant

    Just tried and works perfectly. Good thought, thanks.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.