I have added js script in my footer.phtml to display scrolling onhover for long drop down list, but alignment of the navigation bar is not proper.. I want it to display below main category with proper alignment please guide me script which is responsive
if i give position:absolute then dropdown will align properly but the categories will overlap
below is the script for hover on long dropdown
<script>
var maxHeight = 100;
var maxwidth
jQuery.noConflict();
jQuery(function(){
jQuery(".nav-primary > li").hover(function() {
var jQuerycontainer = jQuery(this),
jQuerylist = jQuerycontainer.find("ul"),
jQueryanchor = jQuerycontainer.find("a"),
height = jQuerylist.height() * 1.1, // make sure there is enough room at the bottom
multiplier = height / maxHeight; // needs to move faster if list is taller
// need to save height here so it can revert on mouseout
jQuerycontainer.data("origHeight", jQuerycontainer.height());
// so it can retain it's rollover color all the while the dropdown is open
jQueryanchor.addClass("hover");
// make sure dropdown appears directly below parent list item
jQuerylist
.show()
.css({
paddingTop: jQuerycontainer.data("origHeight")
});
// don't do any animation if list shorter than max
if (multiplier > 1) {
jQuerycontainer
.css({
height: maxHeight,
overflow: "hidden"
})
.mousemove(function(e) {
var offset = jQuerycontainer.offset();
var relativeY = ((e.pageY - offset.top) * multiplier) - (jQuerycontainer.data("origHeight") * multiplier);
if (relativeY > jQuerycontainer.data("origHeight")) {
jQuerylist.css("top", -relativeY + jQuerycontainer.data("origHeight"));
};
});
}
}, function() {
var jQueryel = jQuery(this);
// put things back to normal
jQueryel
.height(jQuery(this).data("origHeight"))
.find("ul")
.css({ top: 100 })
.hide()
.end()
.find("a")
.removeClass("hover");
})});
//Add down arrow only to menu items with submenus
// jQuery(".nav-primary > li:has('ul')").each(function() {
// jQuery(this).find("a:first").append("<img src='images/down-arrow.png' />");
// });
</script>