jquery不支持toggle()高(新)版本的問題解決
更新時間:2016年09月24日 10:25:13 投稿:lqh
這篇文章主要介紹了jquery不支持toggle()高(新)版本的問題解決的相關(guān)資料,需要的朋友可以參考下
在js代碼中引入以下代碼,讓高版本的jquery兼容toggle事件。代碼如下:
/** * Replacement for toggle */ jQuery.fn.toggle = function( fn, fn2 ) { // Don't mess with animation or css toggles if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) { return oldToggle.apply( this, arguments ); } // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, i = 0, toggler = function( event ) { // Figure out which function to execute var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while ( i < args.length ) { args[ i++ ].guid = guid; } return this.click( toggler ); };
以上就是jquery不支持toggle()高(新)版本的問題解決的資料,希望能幫助到大家,謝謝大家對本站的支持!
您可能感興趣的文章:
- jQuery實(shí)現(xiàn)圖片輪播效果代碼
- jQuery css() 方法動態(tài)修改CSS屬性
- jquery attr()設(shè)置和獲取屬性值實(shí)例教程
- jQuery中的AjaxSubmit使用講解
- jQuery實(shí)現(xiàn)移動端手機(jī)商城購物車功能
- jQuery實(shí)現(xiàn)邊框動態(tài)效果的實(shí)例代碼
- jQuery ui autocomplete選擇列表被Bootstrap模態(tài)窗遮擋的完美解決方法
- bootstrap與Jquery UI 按鈕樣式?jīng)_突的解決辦法
- jQuery 特性操作詳解及實(shí)例代碼
相關(guān)文章
PHP實(shí)現(xiàn)的pdo連接數(shù)據(jù)庫并插入數(shù)據(jù)功能簡單示例
這篇文章主要介紹了PHP實(shí)現(xiàn)的pdo連接數(shù)據(jù)庫并插入數(shù)據(jù)功能,結(jié)合簡單示例形式分析了pdo數(shù)據(jù)庫連接及執(zhí)行基本的插入SQL語句相關(guān)操作技巧,需要的朋友可以參考下2019-03-03php中call_user_func函數(shù)使用注意事項(xiàng)
這篇文章主要介紹了php中call_user_func函數(shù)使用注意事項(xiàng),較為詳細(xì)的講述了call_user_func函數(shù)的用法實(shí)例與注意事項(xiàng),具有一定的參考借鑒價值,需要的朋友可以參考下2014-11-11php字符串中轉(zhuǎn)義成特殊字符實(shí)例講解
在本篇文章里小編給大家分享的是一篇關(guān)于php字符串中轉(zhuǎn)義成特殊字符實(shí)例講解內(nèi)容,對此有興趣的朋友們可以學(xué)習(xí)下。2021-02-02安裝PHP可能遇到的問題“無法載入mysql擴(kuò)展” 的解決方法
安裝PHP可能遇到的問題“無法載入mysql擴(kuò)展” 的解決方法...2007-04-04php獲取數(shù)組元素中頭一個數(shù)組元素值的實(shí)現(xiàn)方法
這篇文章主要介紹了php獲取數(shù)組元素中頭一個數(shù)組元素值的實(shí)現(xiàn)方法,較為詳細(xì)的分析了數(shù)組操作中reset、next、current等函數(shù)的用法,非常具有實(shí)用價值,需要的朋友可以參考下2014-12-12