最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jquery中ready()函數(shù)執(zhí)行的時(shí)機(jī)和window的load事件比較

 更新時(shí)間:2015年06月22日 10:30:57   投稿:hebedich  
這篇文章主要介紹了jquery中ready()函數(shù)執(zhí)行的時(shí)機(jī)和window的load事件比較的相關(guān)資料,需要的朋友可以參考下

jquery的ready()實(shí)現(xiàn)的是 DOMContentLoaded 事件,DOMContentLoaded與window load事件的區(qū)別

簡(jiǎn)單的說ready()是在文檔加載完成就會(huì)觸發(fā),此時(shí)圖片等資源可能還沒有完全加載, load是在所有資源都加載完成后才會(huì)觸發(fā)

看下ready函數(shù)的代碼就什么都清楚了。下面的代碼加上了注釋:

// Handle when the DOM is ready
    ready: function() {
        // Make sure that the DOM is not already loaded
        if ( !jQuery.isReady ) {
            // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
            if ( !document.body ) {
                return setTimeout( jQuery.ready, 13 );
            }

            // Remember that the DOM is ready
            jQuery.isReady = true;

            // If there are functions bound, to execute
            if ( readyList ) {
                // Execute all of them
                var fn, i = 0;
                while ( (fn = readyList[ i++ ]) ) {
                    fn.call( document, jQuery );
                }

                // Reset the list of functions
                readyList = null;
            }

            // Trigger any bound ready events
            if ( jQuery.fn.triggerHandler ) {
                jQuery( document ).triggerHandler( "ready" );
            }
        }
    },

以上所述就是本文的全部?jī)?nèi)容了,希望大家能夠喜歡。

相關(guān)文章

最新評(píng)論

来安县| 普格县| 康定县| 子洲县| 新丰县| 灵丘县| 扎囊县| 青岛市| 翼城县| 自治县| 深圳市| 天津市| 垫江县| 崇仁县| 健康| 南城县| 云霄县| 两当县| 赞皇县| 深泽县| 渝中区| 策勒县| 清水县| 静宁县| 宣化县| 松潘县| 松江区| 威海市| 江都市| 霞浦县| 永州市| 疏勒县| 奈曼旗| 黄石市| 新乡县| 滁州市| 南汇区| 安陆市| 山阴县| 台东县| 德江县|