0

Having a problem on my demo site (http://somm.icorp.net/) what I'm attempting to accomplish is when you click on the LOGIN button a drop down appears and using JQuery, it displays a login box so users don't have to go to a dedicated login page. Problem is it's not functioning and display for #LoginBox stays at none. No errors in console beyond the fact the page isn't secure (yet) but I wouldn't think that would be the reason the pop-up isn't working. Could it be a conflict with the navigation bar underneath? That would be frustrating to be sure.

Here's the code for my .js:

jQuery(function() {
    var button = jQuery('#loginButton');
    var box = jQuery('#loginBox');
    var form = jQuery('#loginForm');
    button.removeAttr('href');
    button.mouseup(function(login) {
        box.toggle();
        button.toggleClass('active');
        alert("onblur called");
    });
    form.mouseup(function() { 
        return false;
    });
    jQuery(this).mouseup(function(login) {
        if(!(jQuery(login.target).parent('#loginButton').length > 0)) {
            button.removeClass('active');
            box.hide();
        }
    });
});
0

its working now:-

    jQuery(function() {
    var $button = jQuery('#loginButton');
    var $box = jQuery('#site-crhead');
    var $form = jQuery('#loginForm');

    $button.live('click',function(login) {
      console.log($box);
        $box.toggle();
        $button.toggleClass('active');

    });
    $form.live('click',function() { 
        return false;
    });
    jQuery(this).live('click',function(login) {
        if(!(jQuery(login.target).parent('#loginButton').length > 0)) {
            $button.removeClass('active');
            $box.hide();
        }
    });
});

Just update your code according to you, even your mouseup function was not working, according to your jquery version, us live function before event.

3
  • It's still not working. Same exact issue as before. What do you mean by 'us live function before event'? or 'Just update your code according to you'? Your text isn't very clear.
    – Adam Bell
    Sep 8 '15 at 17:58
  • Its working dude, the problem is that it only works when you scroll your page down, as its some css issue which I don't know. I said you as I use live function to bind the events in the above code, use that.. And I gave you the mistakes in your code, you correct them by analysing my code that's what I mean.. Just I can gve you proof of my working code is scroll your page down and then click on your login button, it will work..
    – dev
    Sep 8 '15 at 18:13
  • Just replace my code with yours
    – dev
    Sep 8 '15 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.