开发者

Cannot remove mouseover event on Div

开发者 https://www.devze.com 2022-12-29 07:14 出处:网络
I have a weird kind of problem.I have hover event on DIV .On run time i have to insert some elements in to DIV .Hover event should not happen after inserting div elements.But problem is if i hover on

I have a weird kind of problem.I have hover event on DIV .On run time i have to insert some elements in to DIV .Hover event should not happen after inserting div elements.But problem is if i hover on DIV before inserting elements in to the DIV .Hover event is getting carried after inserting the elements.I tried removing attribute it开发者_如何学Gos not working for me...

Please let me know If you have a solution


As gmcalab said, please provide some code.

But, a wild shot from here. Since a class is always applied to an element, no matter the state of that element. Maybe you can write a little javascript to change the class of the DIV after you're done.

<div id="yourdiv" class="foo">

You do your things and finally call:

document.getElementById('yourdiv').className = 'bar';

Then in css something like

.bar:hover { background:#EDEDED; or-whatever-styling:you-need;}

But then again, without a codesample it's a hard guess...

0

精彩评论

暂无评论...
验证码 换一张
取 消