I haven’t written anything for a long time. I only discovered it when I encountered a problem at work today. In the future, I will have to force myself to take more time to write my own things, and also share with you the problems I encountered at work.
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 on the job and encounter problems. Let’s summarize a little and learn a little... Hey, 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:
The code is as follows:
$('#foo').bind({ click: function() { // do something on click }, mouseenter: function() { // do something on mouseenter } });
2. Any string used as the type parameter is legal; if a string is not native The JavaScript event name, then this event handling function 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.
The above is the detailed content of Detailed explanation of jQuery bind event usage. For more information, please follow other related articles on the PHP Chinese website!