How to make the element height return to the initial state?
jsfiddle example
var memoria = $('.menu__drop').height(); $('.children_menu__list').hover(function() { $('.children_menu__drop', this).show(); var menuDropInner = $('.children_menu__drop', this).height(); var menuDrop = $('.menu__drop').height(); var result = 0; if(menuDropInner > menuDrop) { result = $('.menu__drop').height(menuDropInner); } else { result = $('.children_menu__drop').height(menuDrop); } return result; }, function() { $('.children_menu__drop', this).hide(); $('.menu__drop').height(memoria); // не срабатывает корректно });
return result;where is going back? Yes, and hike this entire menu can only be done on css without scripts. There is a huge crutch - Mr. Black