При использовании HISTORY API не работает скрипт почему?
Здравствуйте использую HISTORY API https://github.com/browserstate/history.js/:
(function ($) { var $categoryProducts = $('#content'); $('body').on('click', 'a', function(e){ e.preventDefault(); History.pushState(null, document.title, $(this).attr('href')); }); function loadPage(url) { $('#container').css({opacity: 0.5}); setTimeout(function() { $categoryProducts.load(url + " #content > *", function(){ $('#container').css({opacity: 1}); }); },1000); } History.Adapter.bind(window, 'statechange',function(e){ var State = History.getState(); loadPage(State.url); }); })(jQuery); В одном из подгружаемых фалов идет скрипт аякс подгрузки изображений: (function($) { var pageNo = 1; $.fn.lazyinit = function(options){ var dataContainer = $(this); $(this).find('.pagination').find('.demo').live('click',function(){ var url = $(this).attr('nc_url'); $(dataContainer).lazyshow({url:url,iIntervalId:true}); }); $(this).find('.lazymore').find('a').live('click',function(){ $('.link-show-more_loading').show(); $('.link-show-more__photo').hide(); var url = $(this).attr('nc_url'); setTimeout(function() { $('.link-show-more_loading').hide(); $('.link-show-more__photo').show(); $(dataContainer).lazyshow({url:url,iIntervalId:false}); },1000); }); } $.fn.lazyshow = function(options) { var settings = { iIntervalId:true }; var loadurl = options.url; settings.iIntervalId = options.iIntervalId; var dataContainer = $(this); if(!$(dataContainer).next("#lazytmp")[0]){ $(dataContainer).after('<div id="lazytmp"></div>'); } if(settings.iIntervalId){ pageNo = 1; } $("#lazymore").remove(); $("#lazytmp").load(loadurl+'&delaypage='+pageNo,'',function(){ var html = ''; html += $("#lazymodule").html(); if(settings.iIntervalId === false){ $(dataContainer).append(html); }else{ $(dataContainer).html(html); } $("#lazytmp").html(''); $(dataContainer).find("#lazymore").html('<div class="lazymore"><a class="js-show-more link-show-more link-show-more__photo" href="javascript:void(0);" nc_url="'+loadurl+'">Показать еще</a></div>'); $(".lazymore").append('<div class="link-show-more_loading"><span class="fetching-hor"><span class="fetching-hor_i"></span>загрузка</span></div>'); $(dataContainer).find('.pagination').find('.demo').each(function(){ var a_url = $(this).attr('href'); if(a_url != '' && a_url != undefined){ $(this).attr('nc_url',a_url); } $(this).attr('href','javascript:void(0);'); }); // Membership card $(dataContainer).find('[nctype="mcard"]').membershipCard({type:'shop'}); }); pageNo++; }; })(jQuery); $('#pics_list').lazyinit(); $('#pics_list').lazyshow({url:"index.php?act=sns_album&op=ajax_album_pic_list&id=<?php echo $_GET['id'];?>&mid=<?php echo $output['master_info']['member_id'];?>&page=1",'iIntervalId':true}); При загрузке страницы не используя HISTORY API скрипт нормально работает, но при подгрузке страницы скрипт даже не вызывается. Подскажите как исправить?! Заранее благодарен. |
Часовой пояс GMT +3, время: 00:27. |