css - jquery multiple div drop downs menu -



css - jquery multiple div drop downs menu -

ok ladies , gents. have working i'm losing mind on jquery. (i'm not @ it, learning)

here's fiddle: http://jsfiddle.net/5cra5/4/

because cant show drop downwards dynamically created post query created search button below operations , settings buttons can click have been in div drop down.. works great accept.. when or if.. had settings menu down, , clicked on operations. pull menu away, , not place new one. thought had code right not working way. have missing something. please help. other menus working great in pulls them away, , places right one. hope i'm making sense explaining this.

also, there way create post doesn't happen until div up? when bring downwards seems seamless. found way now. can see replace info before up.

thank you

below jquery code can @ , see i'm doing wrong.

function menucall(div_id, bottom, filename) { $('[id^="menu_"]').animate({"top": "-50px"}, "slow"); $('[id^="menu_"]').delay(500).queue( function(next){$(this).hide();next();}); $.post("/opserv/" + filename, function(ajaxresult){ $('#'+div_id).html(ajaxresult); }); if ($('#'+div_id).css('top') !== bottom + 'px') { $('#'+div_id).queue( function(next){$(this).show();next();}); $('#'+div_id).animate({"top": "+" + bottom + "px"}, "slow"); } else { $('#'+div_id).animate({"top": "-50px"}, "slow"); $('#'+div_id).delay(500).queue( function(next){$(this).hide();next();}); } }

i believe happening because referring same div - both operations , settings buttons pointing menu_panel-2 , causes div toggle acts press settings twice or operations twice (to show , hide menu). have find way first tell function button pressed - whether settings or operations. made adding new variable function - > "type" . have check if type 'ops' operations or 'set' 'settings'. if 1 of them simple showing div. note not allow hide operations or settings menu 1 time opened, way hide if switch search , click search again. have check lastly button pressed adding variable save you, compare 'type'.

http://jsfiddle.net/5cra5/12/

var check = '' function menucall(div_id, bottom, filename,type) { $('[id^="menu_"]').animate({"top": "-50px"}, "slow"); $('[id^="menu_"]').delay(500).queue( function(next){$(this).hide();next();}); $.post("/opserv/" + filename, function(ajaxresult){ $('#'+div_id).html(ajaxresult); }); if ($('#'+div_id).css('top') != bottom + 'px') { $('#'+div_id).queue( function(next){$(this).show();next();}); $('#'+div_id).animate({"top": "+" + bottom + "px"}, "slow"); } else { if(type=='ops' || type =='set'){ if (check == type){ $('#'+div_id).animate({"top": "-50px"}, "slow"); $('#'+div_id).delay(500).queue( function(next){$(this).hide();next();}); } else{ $('#'+div_id).queue( function(next){$(this).show();next();}); $('#'+div_id).animate({"top": "+" + bottom + "px"}, "slow"); } } else{ $('#'+div_id).animate({"top": "-50px"}, "slow"); $('#'+div_id).delay(500).queue( function(next){$(this).hide();next();}); } } check = type; }

hope helps.

jquery css

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -