Write a mouse-over display and leave the disappearing js
Get the data in js when the mouse is hovered, use .append(pop) to paste it into the dom, and display it in the .Micro_video_imgne tag.
Use remove to make the pop disappear when the mouse is moved.
But there is a problem when using remove. When the mouse hovers over pop, the pop label will flash and flash, because the added style (.pop) is within the mouse hover label (.Micro_video_img).
If you use css (display: none), the effect can be achieved perfectly. But the problem is that the tags of the page will be added.
$("body").on("mouseover",".Micro_video_img",function(){ var pop=""; $(this).append(pop); }); $("body").on("mouseout",".Micro_video_img",function(){ $(this).children("div.pop").remove(); });
Cause of flickering: The mouseover event is triggered when the mouse moves to the pop. After the pop is removed, the mouseout event is triggered. In fact, the two events are executed alternately, causing the page to be rendered continuously. of.
Solution: Passing through the element and its child elements will trigger the mouseover event, replace the mouseover/mouseout event with mouseenter/mouseleave.
Try changing to mouseenter
display: none Does it just mean hidden? The position is also moved out of the way. Isn't remove the node removal?
display:none->Hide this person in the house and don’t come out to see anyone
$('#dom').remove()->Keep this person completely off the face of the earth Disappear
visibility:hidden->Many people are living on empty wages and occupying the pit
opacity:0->Wearing the emperor’s new clothes
The above is the detailed content of What is the difference between display:none and remove in css in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!