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)
- Request for Refund Support
- [Docs] Column order classes missing Sass variable name HOT 2
- Incorrect description for Tooltips getInstance method in documentation
- ScrollSpy Problem
- Add `:focus-within` class like `.form-control:focus`
- Deprecation Warning with sass 1.78 HOT 2
- go fuck yourself HOT 1
- `--#{$prefix}form-invalid-border-color` is compiling as `border: 1px solid...` HOT 1
- Outlined checks without IDs HOT 4
- Bootstrap 5 carousel will not autoplay if added to the DOM after page load. HOT 2
- Bootstrap 5 Carousel text only
- `.btn-group-sm` does not work with dropdown in Bootstrap 5.3.3 HOT 1
- Consider making warning text and backgrounds different color variables.
- I would like to be able host Boostrap docs on subpath
- Carousel Images appear below currrent Image, and then replace it. HOT 4
- Collapse’s `aria-expanded` attribute never leaves `true` state. HOT 3
- Uncaught TypeError: $(...).modal is not a function HOT 3
- "justify-content-end" does not align flex items to the right HOT 4
- New deprecations in Sass 1.79 HOT 2
- When using input-group splits when form.field is added HOT 3
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.