Comments (16)
It requires a bit of JS: https://github.com/twitter/bootstrap/blob/master/docs/assets/js/application.js#L42
from bootstrap.
:) Thanks a lot man! Should have realized.
from bootstrap.
I had to add the follow around the code for the dropdown and it worked for me.
$(document).ready(function(){...});
from bootstrap.
Thanks for that too, josh.
from bootstrap.
But how I implement it to my website????
from bootstrap.
@TheoQ, are you asking how to include JavaScript code in your HTML? It would help if you provided more details about your problem.
from bootstrap.
Are you searching for that?
$(document).ready(function(){
$("body").bind("click", function (e) {
$('a.menu').parent("li").removeClass("open");
});
$("a.menu").click(function (e) {
var $li = $(this).parent("li").toggleClass('open');
return false;
});
});
from bootstrap.
@vreon. Thanks for your answer. I included the javascript file on the header, but id doesn't seem it is working. I don't know how to "link" the action when you press the dropdown to the action in the javascript file. I hope I explained well, as I'm just a noob :P Thanks
from bootstrap.
Just give the Dropdown-Link the class 'menu' and the example-code should work.
from bootstrap.
As I'm not understanding quite well, I'll post how I linked the Javascript file, and how I declared menu class lol
< script src="https://github.com/twitter/bootstrap/blob/master/docs/assets/js/application.js" ></ script > in < head >
< ul class="nav secondary-nav" >
< li class="menu" >
< a href="#" class="menu" >More</ a >
< ul class="menu-dropdown" >
< li >< a href="#" >Settings< /a >< /li >
</ ul >
Thanks
from bootstrap.
You're on the right track, but you don't want to hotlink that entire JS file, it's only meant for usage on the docs page. Just use the snippet that @optikfluffel posted.
One way to do this is to put the snippet in a "script.js" file, then include that in the after you include the jQuery library. (There are Googleable tutorials if you're not sure how to do that.)
from bootstrap.
so i just write that file and link it and I'm done?? I am not using jquery. Not yet ;-)
from bootstrap.
Basically, yes. Keep in mind that jQuery is required if you want to use that particular snippet. It's very easy to include.
I fear we've gone far outside the scope of this issue ticket, so feel free to PM me if you're still having trouble.
from bootstrap.
Fine. I'll try that and if I find any problem I'll try to solve it myself first and then I'll PM you. Thanks
from bootstrap.
@TheoQ if you want any more help, feel free to email me!
from bootstrap.
Key point is that you need JQuery: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
from bootstrap.
Related Issues (20)
- Dropdown is not working HOT 4
- Please check the class of "Hidden only on xxl"
- Multiple select doesn't seem to be working HOT 4
- Floating labels: Artificial label background clashing with autofill / per-field styling HOT 1
- Add Linux icon HOT 1
- Please refund me for Bootstrap Theme HOT 1
- Search Bar Not Displaying and Screen Freezing on Double Click on Small Phone Devices HOT 3
- Disabled buttons get colored on colorful background HOT 3
- boot
- Docs have conflicting information regarding customization HOT 1
- [build] 'ip' dependency package flagged with high security advisory flag HOT 1
- Accessibility: Bootstrap must not remove outline on focusable disabled buttons HOT 11
- Inconsistent handling of deprecated dark variants examples HOT 1
- Add extra classes to min-vh-* HOT 2
- Popover content option (passed as function) documentation issue HOT 2
- Form Validation customization HOT 2
- Adding backdrop-filter blur on navbar breaks offcanvas element HOT 4
- Accessibility problems with pagination controls HOT 6
- <code> elements ignore auto-contrasting colors HOT 3
- Carousel shows enlarged image when pressing next or previous if the carousel is wrapped in float CSS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrap.