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)
- Range component inside a card is impossible to see
- Modal "close" button using dark variant not aligned to the right HOT 5
- Padding left and right utilities not working as expected HOT 1
- Carousel moves in reverse direction on iOs safari browser HOT 3
- `aria-disabled` buttons should have same CSS as `disabled` HOT 4
- Docs: No info about the collapse plugin supporting checkboxes as toggles
- input-group + <input type=color> doesn't use whole height HOT 2
- Facing install issue on PPC64LE architecture
- `tooltip.js` error with table editable HOT 3
- Can a react web app have both a Modal Component, and Off-canvas nav menu. When I use both strip and Import. the drop-down toggle in Off-canvas nav does not respond HOT 3
- We need more customizable color scheme for accordion HOT 4
- accent-color can reduce the style size of the current input check box, radio button, and slider. HOT 1
- Documentation page contains YouTube video of Reo Speedwagon
- Potential for contrast issues with '.btn-close' class HOT 2
- Carousel returns incorrect (reversed) directions HOT 3
- Loading of an image is failed under status heading in README.md HOT 1
- Support tables in cards (Gist provided)
- change-version.mjs should also change content aliases links HOT 2
- Quick click issue when during offcanvas opening
- Bootstrap SCSS on NPM does not generate bg-dark classes HOT 1
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.