function get_content(title, content,push) { console.log("load "+content); if(push ==true){window.history.pushState({ path: content }, title, content);} if(content.charAt(0) === "/"){content = content.substr(1);} var pp =content.split('/'); for(var i=pp.length; i>=0; i--) { if(pp[i]==''){pp.splice(i, 1);i++;} } var jqxhr = $.get( "/ajax.php",{page: content, ajax: 'true'}, function(e) { $('#scrollP').animate({ scrollTop:"0"},10,function(){ $('.slimScrollBar').css("top",'0px'); });; $('#contentchange').html(e); var noOfImages = $("#contentchange img").length; var noLoaded = 0; $("#contentchange img").on('load', function(){ noLoaded++; if(noOfImages <= noLoaded) { if(noOfImages == noLoaded) { $('#isotopeContainer').isotope({itemSelector: '.isoitem',getSortData: {name: '.name',category: '[data-category]'},}); if(pp[0]=='works' && pp[1]) { $("span[data-filter='/"+content+"']").addClass('active'); $('#isotopeContainer').isotope({ filter: "."+pp[1] }); } //darbinieki $('#isotope2').isotope({itemSelector: '.isoitem2',getSortData: {name: '.name',category: '[data-category]'}}); horizontal = new inslide("slideContainer"); } $( '.hfirstl').animate({ color: "rgba(255,255,255,0.0)",paddingTop: "0px"}, 1,function(){} ); $('#canvas').animate({opacity: 0.0}, 500, function(){}); $('#topbox').animate({height: '100px'},500,function(){ $( 'h1.hfirstl').animate({ color: "rgba(255,255,255,1.0)",paddingTop: "160px"}, 500,function(){} ); }); } }); //console.log( "success2" ); }); /*.done(function(e) { //$('#contentchange').html( e); }) .fail( function(d, textStatus, error) { console.error("getJSON failed, status: " + textStatus + ", error: "+error); }) .always(function() { console.log( "complete" ); });*/ }