SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Non-Member
    Join Date
    Mar 2010
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with on Blue() fadeOut, code not working...

    Hi,

    I have the following JS code, which slides in one of 2 hidden divs on click, and when you click them or the button the divs fade out.

    I want to replicate the fadeOut on Blur too, but that part of my code isnt working for some reason.

    Im a bit of a noob when it comes to JS, still learning. So any help would be muc apprecited


    CODE:

    Code:
    $(document).ready(function(){
    $(".btn-ncl").toggle(function(){
    
    //Open info
    $(".info-ncl").stop().animate({ down: "+=1200" }, 600)
    $(".info-ncl").stop().slideDown("slow");
    }, function(){
    
    //Close info
    $(".info-ncl").stop().animate({ down: "-=300" }, 1400)
    $(".info-ncl").stop().fadeOut("slow");
    });
    
    
    $(".btn-gh").toggle(function(){
    
    //Open info
    $(".info-gh").stop().animate({ down: "+=1200" }, 600)
    $(".info-gh").stop().slideDown("slow");
    }, function(){
    
    //Close info
    $(".info-gh").stop().animate({ down: "-=300" }, 1400)
    $(".info-gh").stop().fadeOut("slow");
    });
    
    
    $(".info-gh").blur(function(){
    alert('blur');
    $(".info-gh").stop().animate({ down: "-=300" }, 1400)
    $(".info-gh").stop().fadeOut("slow");
    });
    
    });

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2010
    Posts
    105
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not very good with js but i don't think javascript can handle focus event (blur on jquery) for elements like divs. The event is only for links and inputs. hope i'm wrong, because i've tried some while ago to accomplish something like that and I haven't succed

  3. #3
    Non-Member
    Join Date
    Mar 2010
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh really? thank you for your reply, I appreciate that.

    Well if you cant 'blur' when clicking off the div, how can it be set so that the div fades out (hides again) once the user clicks elsewhere on the page?


    Can anyone else shed some light on this?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •