Here is my code
And I pasted it below:
setTimeout(function(){$("div").hover()}, 1000)
div {
background: grey;
width: 20px;
}
div:hover {
width: 200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
test
</div>
I want to use jQuery to trigger the hover
event of <div>
, which will expand its width to 200px
.. However, in the example above, there is no effect at all..
Does anyone have ideas about this?
Hover binds mouseover and mouseout handlers! I Don't think It triggers mouseover event. If you want to apply a style you can do it by adding a class like bellow