freddeh
03-30-2010, 08:15 PM
Hi, i modified the Horizontal Accordeon (http://www.dynamicdrive.com/dynamicindex17/haccordion.htm) a bit (disabled mouseover and added ability to contract items after expanding them):
(only the blue line was put on a different place, everything else is original exept of the mouseover-effects being disabled)
expandli:function(accordionid, targetli){
var config=haccordion.accordioninfo[accordionid]
var $targetli=(typeof targetli=="number")? config.$targetlis.eq(targetli) : (typeof targetli=="string")? jQuery('#'+targetli) : jQuery(targetli)
$targetli.stop().animate({width:$targetli.data('hpaneloffsetw')}, config.speed) //expand current content
if (typeof config.$lastexpanded!="undefined") //targetli may be an index, ID string, or DOM reference to LI
config.$lastexpanded.stop().animate({width:config.paneldimensions.peekw}, config.speed) //contract last opened content
config.$lastexpanded=$targetli
},
Problem is, that after expanding and contracting one item, it cant be expanded again (only if you expand another item before). Guess its because config.$lastexpanded and $targetli are pointing to the same item and the effects are revoking each other. How to check that with javascript?
Thanks for the help!
(only the blue line was put on a different place, everything else is original exept of the mouseover-effects being disabled)
expandli:function(accordionid, targetli){
var config=haccordion.accordioninfo[accordionid]
var $targetli=(typeof targetli=="number")? config.$targetlis.eq(targetli) : (typeof targetli=="string")? jQuery('#'+targetli) : jQuery(targetli)
$targetli.stop().animate({width:$targetli.data('hpaneloffsetw')}, config.speed) //expand current content
if (typeof config.$lastexpanded!="undefined") //targetli may be an index, ID string, or DOM reference to LI
config.$lastexpanded.stop().animate({width:config.paneldimensions.peekw}, config.speed) //contract last opened content
config.$lastexpanded=$targetli
},
Problem is, that after expanding and contracting one item, it cant be expanded again (only if you expand another item before). Guess its because config.$lastexpanded and $targetli are pointing to the same item and the effects are revoking each other. How to check that with javascript?
Thanks for the help!