I’m trying to create a hover-menu inside a gridview like the one of Gmail when you put the mouse over the names in the chatlist.
How to show an element in Jquery after 1-2 seconds only if the mouse is still over the element?
The following is not working properly because if i just move the mouse throughout the list, all the elements will show up (even though with a delay of 1 sec.)
$('.label, .popup').hover(function(e) {
setTimeout(function() {
$(e.target).closest("tr").find(".popup").show();
}, 1000);
}, function(e) {
setTimeout(function() {
$(e.target).closest("tr").find(".popup").hide();
}, 1000);
});
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="label1" CssClass="label" runat="server" Text='<%# Eval("Column1") %>'></asp:Label>
<asp:Panel runat="server" ID="popup" CssClass="popup"
Style="display: none; position: absolute; margin-left: 60px; width: 250px;">
Random text
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
Clear the setTimeoutin the mouseout function, so if 1 second hasn’t passed since mouse over the element isn’t shown.