PDA

View Full Version : Checking if variables are pointing to same object



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!

ddadmin
03-31-2010, 08:14 AM
Hmm do you have a URL to the changed script we can check out, just to get a clearer picture of the issue?

freddeh
03-31-2010, 10:43 PM
http://fhweb.bplaced.net/sites/test/

Click 3 times on one item and it won't work again :(

freddeh
04-03-2010, 10:36 AM
No idea? thought it would be just an missing if-clause to fix that problem.