0

I am a newbie and I can't figure out how to get rid of "#!/". I did not create this code each time I open a page it comes up like this:

site/index.html#!/
site/index.html#!/page_home
site/index.html#!/page_portfolio

pages.js:

$(window).load(function() { 
    var act='';

    $('#content > ul > li').css({position:'absolute', display:'none'});
    $('#content > ul > li').find('.box1').css({height:'0'})

    $('#menu > li > a span').css({opacity:'0'})

    $('#menu > li > a').hover(function(){
        $(this).find(' > span').stop().animate({opacity:'1'},600);                         
    }, function(){
        if (!$(this).hasClass('active')) {
            $(this).find(' > span').stop().animate({opacity:'0'},600);                         
        }
    })

    $('#menu > li').each(function(num){
        $(this).data({num:num})
    })
    $('#content > ul > li').each(function(num){
        $(this).data({num:num})
    })

    if (location.hash.slice(0,3)=='#!/') {
        page=location.hash.slice(3);
        open_page('#'+page);
        fl=false;
    }
    if ((location.hash=='#')||(location.hash=='')) {
        open_page('');
        fl=true;
            $('#content').stop().animate({height:'668'})
    }
    $('a').click(function(){
        if ($(this).attr('href').slice(0,3)=='#!/') {
            page=$(this).attr('href').slice(3); 
            open_page('#'+page);
            return false;
        }
        if ($(this).attr('data-type')=='close') {
            close_page()    
        }
    })
    function open_page(page){
        location.hash='#!/'+page.slice(1);
        $('#menu a').removeClass('active').find(' > span').stop().animate({opacity:'0'},600);
        Cufon.replace('#menu a', { fontFamily: 'Ubuntu', hover:true });
        num=$(page).data('num');
        $('#menu > li').each(function(){                      
            if ($(this).data('num')==num) {
                $(this).find('> a').addClass('active').find('> span').stop().animate({opacity:'1'},600);
                Cufon.replace('#menu a', { fontFamily: 'Ubuntu', hover:true });
            }
        })
        fl=false;
        $('#content').stop().animate({height:'868'})
        if (act!='') {
            $(act).find('.box1').stop().animate({height:'0'},700,'easeOutCirc', function(){
                $(act).css({display:'none'});
                $(page).css({display:'block'}).find('.box1').stop().animate({height:'100%'},700, 'easeOutCirc', function(){
                    act=page;   
                }); 
            })
        } else {
            $(page).css({display:'block'}).find('.box1').stop().animate({height:'100%'},700, 'easeOutCirc', function(){
                act=page;   
            });     
        }
    }
    function close_page(page){
        $('#menu a').removeClass('active').find(' > span').stop().animate({opacity:'0'},600);
        Cufon.replace('#menu a', { fontFamily: 'Ubuntu', hover:true });
        location.hash='#';
        $(act).find('.box1').stop().animate({height:'0'},700,'easeOutCirc', function(){
            $(act).css({display:'none'});
            act='';
            fl=true;
            $('#content').stop().animate({height:'668'})
        }); 
        return false;
    }
})
t0mppa
  • 3,983
  • 5
  • 37
  • 48
  • not exactly helpful with the removal part, but might be helpful to understand those hashbang urls http://stackoverflow.com/questions/3009380/whats-the-shebang-hashbang-in-facebook-and-new-twitter-urls-for – gherkins Feb 03 '14 at 17:59
  • ah thanks picked this up: I always assumed the ! just indicated that the hash fragment that followed corresponded to a URL, with ! taking the place of the site root or domain. It could be anything, in theory, but it seems the Google AJAX Crawling API likes it this way. The hash, of course, just indicates that no real page reload is occurring, so yes, it’s for AJAX purposes. – user3266895 Feb 03 '14 at 18:10
  • so I guess its a good thing? I find it ugly but if google likes it...:) – user3266895 Feb 03 '14 at 18:11

0 Answers0