- PROPER EVENT BINDING: Consider using the preferred .on() method rather than .click(), .bind(), .hover(), etc. For best performance and concise code use event delegation whenever possible:
What does it mean. What kind of code can I use instead of the hover code here? Please help me.
My code block as follows;
(document).ready(function(){ (‘ul li.dropdown’).hover(function() {
(this).find('.dropdown-menu').stop(true, true).delay(100).fadeIn(100); }, function() { (this).find(’.dropdown-menu’).stop(true, true).delay(100).fadeOut(100);
});
});
Hi
You should write code as like this:
$(".selector").on("mouseover", function () { //stuff to do on mouseover });
Thanks
Thanks. Tried not working. My project link: http://elsetea.com/Anagha/index.html
I’ve only studied navbar here.
How I will check your localhost? Please study and spent some times in google search.
For best performance and concise code use event delegation whenever possible: https://codepen.io/32bitkid/post/understanding-delegated-javascript-events
You’re right, I immediately noticed and changed. I guess I’m a little late. Thank you.
your page has error: TypeError: $(…).countdown100 is not a function
please fix error and use PROPER EVENT BINDING for all necessary scope as like for .click use .on(‘click’,
you can get more help from google search.
Thank you very much for your valuable time. I will search.
Best regards…
Solution;
(document).on({
mouseenter: function() {
(this).find(’.dropdown-menu’).stop(true, true).delay(100).fadeIn(100);
},
mouseleave: function() {
$(this).find(’.dropdown-menu’).stop(true, true).delay(100).fadeOut(100);
}
}, ‘ul li.dropdown’);