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)
- Header Link's href to Link to the Most Recent Version of the Same Article HOT 2
- Floating Label: position is not correctly aligned HOT 6
- Update Twitter Icon to X Logo Across Bootstrap Website HOT 2
- Use the new HTML popover attribute for dropdown and popovers
- Introduce Grid Debugger Class for Bootstrap Containers
- Everything is in Arabic... HOT 1
- Fix Sass deprecation warnings HOT 2
- listitem should not be able to be disabled HOT 1
- Bootstrap 5.3.3 bs-primary-rgb does not get overridden even after overriding primary colors and bg-primary HOT 1
- Importing bootstrap.scss breaks SASS compilation for tables component
- bootstrap docs: Windows high contrast: navbar has transparent background
- Document how to show/collapse/toggle an accordion item via Javascript
- Numerous sass deprecation warnings HOT 1
- Outer right border radius not applied to datalist in an input group HOT 3
- Add Utility Class for Rounded Borders HOT 3
- New 4.6.x version solving CVE-2024-6531 HOT 3
- Docs: the .valid-feedback and .invalid-feedback classes are insufficiently documented in the Forms Validation page
- npm package is NOT 5.3.3 - out of date or simple missing features HOT 1
- Question about attribution
- Documentation error 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.