メインコンテンツをロードするために ajax を使用しているサイトがあり、完了afterLoad
後に次のコードを使用して関数 ( )を実行しています。.load()
jQuery('.main-menu a').click(function(evt){
var href = jQuery(this).attr('href');
var elementClassName = jQuery(this).attr('class');
History.pushState({}, '', href);
jQuery('.content').load(href+ ' #main',afterLoad);
function afterLoad() {
jQuery('.content').fadeIn(750);
if (document.location.pathname == "/works/") {
jQuery(function($){ window.dzsp_init("#port0",{
settings_slideshowTime:3
,settings_mode: "masonry"
,title: ""
,design_item_width: ""
,design_item_height: ""
,design_categories_style: "normal"
,design_categories_pos: "top"
,design_pageContent_pos: "top"
,settings_disableCats: "off"
,settings_lightboxlibrary: "zoombox"
,settings_preloadall: "off"
,audioplayer_swflocation: "http://sbmdesigns.net/wp-content/plugins/dzs-portfolio/ap.swf"
,videoplayer_swflocation: "http://sbmdesigns.net/wp-content/plugins/dzs-portfolio/preview.swf"
,disable_itemmeta: "off"
,settings_ajax_loadmoremethod: "button"
,settings_mode_masonry_layout: "masonry"
,design_total_height_full: "off"
,settings_mode_masonry_layout_straightacross_setitemsoncenter: "off"
,design_item_height_same_as_width : "off"})
});
}
}
return false;
});
すべて正常に動作しますが、完了afterLoad
する前に実行されることが.load()
あります。とにかく、afterLoad
起動する前にすべての読み込みが完了していることを確認するために遅らせることはありますか?