Hello, in this jQuery video, I'm going to show you the mouse enter event. So the mouse enter, simply put, when this math cursor enters their facility, so basically when hovering over a element, it gets triggered. So I'm just going to do it on a div, we can use any selector you want to select the div and the event itself from the mouse enter and then description as you normally would for any event. And now I'm gonna say console dot log. entered. And as you can see, you might think in Boise, Anthony here.
Even though I'm not hovering over it, let me inspect you and show you and if because this is what you call A block level element, the display is blocked. And that just means it gets it spans the entire row. If, for example, I had a span, which was an inline level element, rather say, epic plan, I'll save that I will. This code or this changes to span, I'll say enter, div. Reload, see what we get? for nothing, so far, nothing, nothing, nothing.
For here, do nothing. We get it only when we hover over it. But whereas if we go up, even though we're not hovering over the text, because a block level element is banned the entire row. So a use case for this nice enter could be when you hover over something you actually don't do so. up into it. Sorry about that garbage too excited about the mess and ticularly.
So when, you know, hover over it when the mouse enters, you could do something like, you know, change the styling of it. You might be thinking, why would you do that in JavaScript and jQuery when you can achieve basically that in CSS, and that's why you can achieve it in CSS. But with CSS, you have certain limitations. For example, maybe the actual mouse enter sort of code or the change if pieces of styling code only occurs based on a number of event that is triggered on your page, then you could detect that event are in JavaScript. Keep a record of that using some sort of variable other flag, then only then would the match and to do something or maybe the method to do something differently if the event hadn't occurred. Another thing is, maybe it doesn't actually do something to do with style.
Perhaps you are Creating the next and greatest video service to compete with YouTube and to compete with Netflix. And perhaps you are determined that you know, or you have an algorithm that can detect what video the user is going to click on there, say with 120,000,000,000% accuracy, which will be very accurate to me, I add. And as a result, what you decide is, when the user is hovering over the videos, this is what you use to determine, you know which one they're going to click on. And why they do not use stop streaming that video in the background. So when you actually go to click it, it's already streamed. So that's another use case.
It doesn't have to be stylistic. A lot of times it is but it could be other. You know, you have other use cases as well. That's the messenger. I've got a separate video covering the mouse leave which you can guess what that does, feel free to check record that video. If you have any questions, pop me a message.
And as usual, I look forward to seeing you in the next tutorial.