Home > Web Front-end > JS Tutorial > Detailed explanation of jQuery bind event usage_jquery

Detailed explanation of jQuery bind event usage_jquery

WBOY
Release: 2016-05-16 18:07:07
Original
886 people have browsed it

I have been using jquery for nearly a year. Today I was looking at the code of a foreign expert and suddenly found a place that I didn’t understand. The code is as follows

 $(window).bind('load.jcarousel', function() { windowLoaded = true; });

Maybe I don’t know much about jQuery. I have only read an introductory book on jQuery, and then I always study at work. When I encounter problems, I summarize them and learn. A little... Hehe, maybe why companies always recruit people with more than 1 year of work experience or something. It is true that actual practice is the fastest way for people to improve.

Find the jQuery API, which is explained as follows:

1. Multiple events can be bound at one time. For example:

Copy code The code is as follows:

$('#foo').bind( {
click: function() {
// do something on click
},
mouseenter: function() {
// do something on mouseenter
}
} ); 

2. Any string as the type parameter is legal; if a string is not a native JavaScript event name, then the event handler will be bound to a custom event . These custom events are never triggered by the browser, but can be triggered manually in other code by using .trigger() or .triggerHandler().

3. If the string of the type parameter contains a dot (.) character, then this event is regarded as having a namespace. This dot character is used to separate the event from its namespace. For example:

$obj.bind('click.name', handler) Then the click in the string is the event type, and the string name is the namespace.

Okay, that’s it, I’m going home from get off work. This month, let’s summarize a jQuery development model. Be sure to be prepared. Finally, I hope this article can be helpful to you.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template