...

View Full Version : jkpanel auto hide



ratkins
12-22-2009, 10:24 PM
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!

ratkins
01-05-2010, 05:26 PM
I figured this out myself. Seems obvious now, but took me a while...



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)})
})
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum