0

I am trying to create a menu where when you click anywhere else on the page the div will be hidden. This works in everything but firefox. In firefox, when you click on one of the links within the section it will not go to the link, it just closes the div.

code:

$(document).mouseup(function(e){//removes menu when clicked on any other part of page
    if($(".menuone:visible").length > 0  ){
        $('.menuone').hide();
    }
});

HTML:

<div class="menuone">
<div class="col1">
<ul><li>Example link</li></ul>
</div>
</div>

2 Answers 2

2

You should set up a variable that can keep track of the hover state of the .menuone div.

Then your if statement will be:

if($(".menuone:visible").length > 0 && !menuHover )

That should do the trick.

Hope it helps :)

edit:

var menuHover = false;

$(".menuone").bind('mouseenter mouseleave',function(e){
    menuHover = e.type == 'mouseenter';
});
Sign up to request clarification or add additional context in comments.

2 Comments

Did you set up a function to actually set the variable?
Well, that wont work, you need to actually set the variable and change it on the relevant mouse events. See the edit for the rest of the code you'll need.
0

I like the idea mentioned here at John Resig's site:

var outerPane = $details.find(".details-pane-outer"),
    didScroll = false;
$(window).scroll(function() {
    didScroll = true;
});

setInterval(function() {
    if ( didScroll ) {
        didScroll = false;
        // Check your page position and then
        // Load in more results
    }
}, 250);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.