Twitter Bootstrap Toggle Dropdown on Mouseover

When combining Bootstrap tables with libraries like datatables for sorting you need to use the click function to sort the field and not initiate the dropdown. So the logical thing to do is to toggle the dropdown on mouseover.

This is how I accomplish this task:

  	  <th>
              <ul class="nav">
	      <li class="dropdown">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="status_filter_dropdown">
                    Notification Status <span class="caret"></span>
                 </a>
                 <ul class="dropdown-menu">
                   <li><a class="status_filter" selected>Open</a></li>
	           <li><a class="status_filter">Closed</a></li>
	           <li><a class="status_filter">All</a></li>
                  </ul>
              </li>
	     </ul>
	  </th>
$(".dropdown-toggle").mouseover(function(){
	     $(this).dropdown('toggle');
	});
Advertisements
Tagged , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: