admin管理员组

文章数量:1414621

I have a menu which I have assigned the affix class using the JS and the data-spy methods but it doesn't work, there are no JS errors in my console (firefox or chrome) and the js and css of BS are at 3.3.1. I am using WordPress, the files are all enqueued and everything else works fine.

I have deactivated all the plugins (although none use BS), I have deleted all the other scripts I enqueued

Navigation HTML:

<nav class="navbar navbar-inverse navbar-static-top" id="nav" rol="navigation">

My Affix JS is:

jQuery('#nav').affix({
  offset: {
   top: 580
  }
 });

Anyone able to point me in a direction to find the cause?

I have a menu which I have assigned the affix class using the JS and the data-spy methods but it doesn't work, there are no JS errors in my console (firefox or chrome) and the js and css of BS are at 3.3.1. I am using WordPress, the files are all enqueued and everything else works fine.

I have deactivated all the plugins (although none use BS), I have deleted all the other scripts I enqueued

Navigation HTML:

<nav class="navbar navbar-inverse navbar-static-top" id="nav" rol="navigation">

My Affix JS is:

jQuery('#nav').affix({
  offset: {
   top: 580
  }
 });

Anyone able to point me in a direction to find the cause?

Share Improve this question edited Apr 6, 2019 at 9:30 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Dec 18, 2014 at 19:05 Gareth GillmanGareth Gillman 1,3221 gold badge10 silver badges18 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I see that jQuery is loading in the source, but I did not see the bootstrap js file. Here is an example of how you would properly enqueue bootstrap into WordPress and set jQuery as dependency.

Github Gist to enqueue Bootstrap

本文标签: wp enqueue scriptBootstrap sticky menu in WordPress