Drop Down Menu using Bootstrap

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
User avatar
astrada
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Mon Dec 28, 2009 10:43 am

Re: Drop Down Menu using Bootstrap

Post by astrada » Thu Jul 03, 2014 4:46 pm

Hey ppl
This issue almost gave me headache.
I used mambolines code just tweaked it a bit

Code: Select all

 (function($){   
    $(document).ready(function(){
      // dropdown
      $('.parent').addClass('dropdown');
    $('.parent > a').addClass('dropdown-toggle');
    $('.parent > a').attr('data-toggle', 'dropdown');
     $('.parent > a').append('<span class="caret"></span>');
	 $('.parent > ul').addClass('dropdown-menu');
	 $('.parent > ul').attr('role','menu');
    jQuery('ul.dropdown-menu li.dropdown a.dropdown-toggle').hover(
              function () {
                jQuery('ul.dropdown-menu li.dropdown').removeClass('open');
                jQuery(this).parent().addClass('open');
              }
          );
        });
  })(jQuery);
And I had to take bootstrap dropdown js from git and i used it like this

Code: Select all

$doc->addScript($this->baseurl . '/media/jui/js/bootstrap-dropdown.js', 'text/javascript');
And then i went to menu manager - edit menu item- external url, and in link field i put ##.
Not one #, that wouldnt work, but two.

krishunt
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 139
Joined: Wed Feb 08, 2012 8:37 pm

Re: Drop Down Menu using Bootstrap

Post by krishunt » Wed Nov 02, 2016 7:03 pm

I was able to get my dropdown menus working with this code:

Code: Select all

<skript type="text/javascript">
    jQuery(document).ready(function(){
       jQuery('.navbar .parent').addClass('dropdown');
       jQuery('.navbar .parent > a').addClass('dropdown-toggle');
       jQuery('.navbar .parent > a').attr('data-toggle', 'dropdown');
       jQuery('.navbar .menu > .parent > a').append('<b class="caret"></b>');
       jQuery('.navbar .parent > ul').addClass('dropdown-menu');
   });
</skript>
But when I expand a parent menu in mobile mode, I cannot collapse it again by tapping the menu item a second time. Anybody know of a fix for this?


Locked

Return to “Templates for Joomla! 3.x”