Code Monkey home page Code Monkey logo

Comments (16)

vreon avatar vreon commented on April 19, 2024

It requires a bit of JS: https://github.com/twitter/bootstrap/blob/master/docs/assets/js/application.js#L42

from bootstrap.

qcom avatar qcom commented on April 19, 2024

:) Thanks a lot man! Should have realized.

from bootstrap.

joshminnie avatar joshminnie commented on April 19, 2024

I had to add the follow around the code for the dropdown and it worked for me.

$(document).ready(function(){...});

from bootstrap.

qcom avatar qcom commented on April 19, 2024

Thanks for that too, josh.

from bootstrap.

mantecon-ricardo avatar mantecon-ricardo commented on April 19, 2024

But how I implement it to my website????

from bootstrap.

vreon avatar vreon commented on April 19, 2024

@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.

optikfluffel avatar optikfluffel commented on April 19, 2024

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.

mantecon-ricardo avatar mantecon-ricardo commented on April 19, 2024

@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.

optikfluffel avatar optikfluffel commented on April 19, 2024

Just give the Dropdown-Link the class 'menu' and the example-code should work.

from bootstrap.

mantecon-ricardo avatar mantecon-ricardo commented on April 19, 2024

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.

vreon avatar vreon commented on April 19, 2024

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.

mantecon-ricardo avatar mantecon-ricardo commented on April 19, 2024

so i just write that file and link it and I'm done?? I am not using jquery. Not yet ;-)

from bootstrap.

vreon avatar vreon commented on April 19, 2024

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.

mantecon-ricardo avatar mantecon-ricardo commented on April 19, 2024

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.

qcom avatar qcom commented on April 19, 2024

@TheoQ if you want any more help, feel free to email me!

from bootstrap.

matburnham avatar matburnham commented on April 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.