Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).on("click","#flymenu li a", function() {
- var url = $(this).attr('href');
- //loadContent(url,true);
- $.get(url,function(response){
- flymenu = $("#flymenu",response).html();
- $('#flymenu').html(flymenu);
- heading = $("#main_header",response).html();
- //$('#flymenu').append(content);
- $('#main_header').html(heading);
- // mytitle = $("head title",response).html();
- $('title').html(heading);
- // alert(mytitle);
- // keep the height of page when loading through ajax
- $("#maincontent").css('height',maincontent_height);
- // product_slider = $(".product-slider",response).html();
- product_slider = $(".product-slider",response).html();
- $('.product-slider').html(product_slider);
- carousel = $("#bx-pager",response).html();
- $('#bx-pager').html(carousel);
- //var stateObj = { foo: "bar" };
- history.pushState('', heading, url);
- destroyslider();
- prepareslider();
- });
- return false;
- });
- function loadContent(url,setState) {
- setState = typeof setState !== 'undefined' ? setState : true;
- $.get(url,function(response){
- flymenu = $("#flymenu",response).html();
- $('#flymenu').html(flymenu);
- heading = $("#main_header",response).html();
- //$('#flymenu').append(content);
- $('#main_header').html(heading);
- // mytitle = $("head title",response).html();
- $('title').html(heading);
- // alert(mytitle);
- // keep the height of page when loading through ajax
- $("#maincontent").css('height',maincontent_height);
- // product_slider = $(".product-slider",response).html();
- product_slider = $(".product-slider",response).html();
- $('.product-slider').html(product_slider);
- carousel = $("#bx-pager",response).html();
- $('#bx-pager').html(carousel);
- if (setState) {
- //var stateObj = { foo: "bar" };
- history.pushState('', heading, url);
- }
- destroyslider();
- prepareslider();
- });
- }
- // THIS EVENT MAKES SURE THAT THE BACK/FORWARD BUTTONS WORK AS WELL
- window.onpopstate = function(event) {
- //$("#loading").show();
- console.log("url changed: "+location.pathname);
- loadContent(location.pathname,false);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement