2

What is the simplest way to change the Bootstrap menu from dropping down on click, rather than on hovering?

sample url: http://riverc.mgns.se

Can this be achieved via bootstrap, purely by CSS or a bit of JavaScript?

1

2 Answers 2

1

Add this line in your javascript code:

$('.dropdown-toggle').dropdownHover();
Sign up to request clarification or add additional context in comments.

2 Comments

mmm... just tried on another site and get "Uncaught TypeError: Object [object Object] has no method 'dropdownHover' " I place it in my <head>
Add jQuery in your head first then in <script type="text/javasccript"> tag you will palce the above code :)
0

In twitter bootstrap dropdown, the dropdown is controlled by css so click like process cnt be done using css, so you have to use javascript or jquery for this...

Idea is that use two class for that toggle,

.off { display:none; }
.on { display:block; }

Develop your script with the help of this, http://api.jquery.com/toggleClass/

3 Comments

Ok... so I have a class of class="dropdown parent" on my li for the dropdown - how would I make this onclick via jQuery?
yes, but make sure the element you click and element you want to toggle class must have unique id...
ok... so I have it working where the dropdown stays down when clicked, but still drops down when hovered - jQuery('.dropdown-toggle').dropdown(); I need to take away the onhover - ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.