How to use toggle method in jquery1.9.1
The editor will share with you how to use the toggle method in jquery1.9.1. I hope you will get something after reading this article. Let's discuss it together.
How to use jquery1.9.1 toggle: 1, open the corresponding js code; 2, add "$. Fn.toggle = function (fn, fn2) {...}" code to the js to bind the toggle function to the element.
This article operating environment: windows7 system, jquery1.9.1 version, DELL G3 computer
How do I use the toggle function in versions above jquery1.9?
The toggle () method is used to bind two or more event handler functions in response to the alternating click event of the selected element.
However, this feature has been removed in versions 1.9 and above.
Feel that this function is still good, the following from online collection, you can add the following code to the js, and then you can bind the element to the toggle function.
Fn.toggle = function (fn, fn2) {var args = arguments,guid = fn.guid | | $.guid + +, iS0, toggle = function (event) {var lastToggle = ($. _ data (this, "lastToggle" + fn.guid) | | 0)% I; $. _ data (this, "lastToggle" + fn.guid, lastToggle + 1); event.preventDefault (); return args [lastToggle] .apply (this, arguments) | | false;} Toggle.guid = guid; while (I < args.length) {args [ionization +]. Guid = guid;} return this.click (toggle);}; after reading this article, I believe you have a certain understanding of "how to use the toggle method in jquery1.9.1". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!