javascript - Get Position and Width of Parent Menu -
i want know how parent position , width jquery. example
<ul id="menu"><li>parents</li> <ul><li>child</li></ul> </ul>
my jquery:
if($('#menu > li > ul').children('li').hasclass('current-menu-item')){ //do animate left: $(this).parent().siblings().position().left;, width: $(this).parent().siblings().width(); });
in case, @ <li>child</li>
. how position , width of <li>parents</li>
?
var parent = $('#menu .current-menu-item').parent().closest('li'); var position = parent.position(); var width = parent.width();
Comments
Post a Comment