Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    jkpanel auto hide

    I am using jkpanel and would like it to automatically close after some time, at at least when the mouse is moved out of the panel.

    Has anyone done this and could share the details.

    Thank you!

  • #2
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Resolved

    I figured this out myself. Seems obvious now, but took me a while...

    Code:
    close:function($, speed){
       if (this.$mainpanel.attr('openstate')=='open')
          this.$mainpanel.animate({top: -this.contentdivheight+'px'}, speed).attr({openstate: 'closed'})
    },
    
    init:function(file, height, speed){
       jQuery(document).ready(function($){
          jkpanel.$mainpanel=$('<div id="dropdownpanel"><div class="contentdiv"></div><div class="control">'+jkpanel.controltext+'</div></div>').prependTo('body')
          var $contentdiv=jkpanel.$mainpanel.find('.contentdiv')
          var $controldiv=jkpanel.$mainpanel.find('.control').css({cursor: 'wait'})
          $contentdiv.load(file, '', function($){
             var heightattr=isNaN(parseInt(height))? 'auto' : parseInt(height)+'px'
             $contentdiv.css({height: heightattr})
             jkpanel.contentdivheight=parseInt($contentdiv.get(0).offsetHeight)
             jkpanel.$mainpanel.css({top:-jkpanel.contentdivheight+'px', visibility:'visible'}).attr('openstate', 'closed')
             $controldiv.css({cursor:'hand', cursor:'pointer'})
          })
          $contentdiv.mouseout(function(){jkpanel.close($, speed)})
          jkpanel.$mainpanel.click(function(){jkpanel.openclose($, speed)})
       })
    }


  •  

    Posting Permissions

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