I want to trigger the mouseover event of a a list item which is a child element of an the object I am working with but the event refuses to be triggered. I used the hover pseudo selector in CSS and now trying to get approach it in Javascript; could that be the reason for the defiance? My code below:
(function() {
$(document).scroll(function() {
var pullOnce = false;
if (!pullOnce) {
if ($("html body")[0].scrollTop > 290) {
$(".how").css("margin-top", "initial");
pullOnce = true;
}
}
// Using true here since the above condition would have set it to true (680 > 290 ;) )
if (pullOnce) {
if ($("html body")[0].scrollTop > 680) {
$(".header").addClass("fix");
$("h1.header").css("width", "70%").siblings("#amount").css({"right": "0", "width": "10%"}).siblings("nav").css("right", "10%").find("li").trigger("mouseover");
}
else {
$(".header").removeClass("fix").find("li").trigger("mouseout");
}
}
});
})();
Markup can be found at