So, I did that in layout.html and it improves thing. The only little glitch
is that subSubMenu are not displaying at the rigth place, they just show
below the actual a hover element, they should appear beside this element. I
try to figure out which piece of web2py_bootstrap.js is responsible of that
behavior :
<script
src="{{=URL('static','js/jquery.hoverIntent.minified.js')}}"></script>
<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[
$(document).ready(function(){
jQuery('.nav>li>a').each(function(){
if(jQuery(this).parent().find('ul').length)
jQuery(this).attr({'class':'dropdown-toggle','data-toggle':'dropdown'}).append('<b
class="caret"></b>');
});
var config = {
over: showBootrapSubmenu,
timeout: 300,
out: hideBootrapSubmenu
};
function showBootrapSubmenu(){
$(this).addClass('open');
}
function hideBootrapSubmenu(){
$(this).removeClass('open');
}
//Hover intent for Submenus
$(".dropdown").hoverIntent(config);
});
// ]]>
</script>
To get the minified version of hoverIntent v6 :
http://cherne.net/brian/resources/jquery.hoverIntent.minified.js
Richard
On Tue, Dec 4, 2012 at 3:25 PM, Paolo Caruccio
<[email protected]>wrote:
> I'm not the creator of the code in web2py_bootstrap.js that manages the
> dropdown behavior, I only added the code to adjust it on resize event.
>
> Originally the bootstrap dropdown hasn't a hover event (in this article
> the reasons explained
> http://markdotto.com/2012/02/27/bootstrap-explained-dropdowns/)
> The code in web2py makes possible to show/hide - with a fade effect - the
> dropdown main container, while the menu and submenus items navigation is
> provided by bootstrap itself.
>
> That said, I don't think that the odd behavior noticed by you is due to js
> code. I didn't have any notice of that (actually topbar has class
> nav-inverse) in IE9, IE8, FF last versions, OP last versions and CH last
> versions on windows7. Only in IE7 web2py dropdown has some showing issue
> but I have already submitted a patch.
>
> Could you delete following rule in web2py_bootstrap.css (in "other rules"
> section row 178) and see if your issue disappears?
>
> .navbar-inner{
> position:relative; /*unnecessary ??*/
> }
>
> Anyway if you are interested, there is a small snippet in order to use
> hoverintent with bootstrap dropdown here<http://stackoverflow.com/a/12960711>
>
>
> Il giorno martedì 4 dicembre 2012 19:49:24 UTC+1, Richard ha scritto:
>>
>> This could be interesting add on :
>>
>> http://cherne.net/brian/**resources/jquery.hoverIntent.**html<http://cherne.net/brian/resources/jquery.hoverIntent.html>
>>
>> Richard
>>
>> On Tue, Dec 4, 2012 at 1:43 PM, Richard Vézina <[email protected]>wrote:
>>
>>> I found that just replacing delay() and fade*() by show() and hide()
>>> solve most problem.
>>>
>>> Here the code :
>>> // this code improves bootstrap menus and adds dropdown support
>>> jQuery(function(){
>>> jQuery('.nav>li>a').each(**function(){
>>> if(jQuery(this).parent().find(**'ul').length)
>>>
>>> jQuery(this).attr({'class':'**dropdown-toggle','data-toggle'**:'dropdown'}).append('<b
>>> class="caret"></b>');
>>> });
>>> jQuery('.nav li li').each(function(){
>>> if(jQuery(this).find('ul').**length)
>>> jQuery(this).addClass('**dropdown-submenu');
>>> });
>>> function hoverMenu(){
>>> var wid = document.documentElement.**clientWidth; //faster than
>>> $(window).width() and cross browser
>>> if (wid>=980){
>>> jQuery('ul.nav a.dropdown-toggle').parent().**hover(function(){
>>> mi = jQuery(this).addClass('open');
>>> mi.children('.dropdown-menu').**stop(true, true).show();
>>> }, function(){
>>> mi = jQuery(this);
>>> mi.children('.dropdown-menu').**stop(true, true).hide(0,
>>> function(){mi.removeClass('**open')});
>>> });
>>> };
>>> }
>>> hoverMenu(); // first page load
>>> jQuery(window).resize(**hoverMenu); // on resize event
>>> jQuery('ul.nav li.dropdown a').click(function(){window.**
>>> location=jQuery(this).attr('**href');});
>>> // make all buttons bootstrap buttons
>>> jQuery('button, form input[type="submit"], form input[type="button"]').
>>> **addClass('btn');
>>> });
>>>
>>> Richard
>>>
>>>
>>> On Tue, Dec 4, 2012 at 1:03 PM, Richard Vézina <[email protected]>wrote:
>>>
>>>> Hello,
>>>>
>>>> I just check the trunk and don't see any improvement at the dropmenu
>>>> script level.
>>>>
>>>> I appreciate the little script to allow the bootstrap menu to works as
>>>> superfish use to work, but actually they are pretty not usable in
>>>> production.
>>>>
>>>> I explained, it may be possible that the problem I face have be not
>>>> notice by someone who not use the welcome layout or use it with the default
>>>> bootstrap top nav bar color (black). But the hover of the main entry of the
>>>> top navbar are not working properly and it can be appreciate when use
>>>> navbar inverse bootstrap class. The hover sometimes stick other time
>>>> disappear, etc.
>>>>
>>>> Also, when you quit the main entry to go in the submenu, sometime they
>>>> just close baldly.
>>>>
>>>> I try to tweak the script, but I don't understand it pretty well. I
>>>> will try again.
>>>>
>>>> Maybe the one that implement that could have look at it. I think it is
>>>> Paolo, but I am not sure.
>>>>
>>>> Thanks.
>>>>
>>>> Richard
>>>>
>>>> On Tue, Dec 4, 2012 at 9:56 AM, Massimo Di Pierro <
>>>> [email protected]> wrote:
>>>>
>>>>> he file is there but looks like it was not committed to git. Did you
>>>>> get from github?
>>>>>
>>>>
>>>>
>>>
>> --
>
>
>
>
--