views:

26

answers:

1

Hi, ok I try to load the .content of my site with jQuery, when I run it local, it shows smoth and nice but when I test it on a host server, the animation is too slow an cuts... and the "loading bar" doesn't show up... :S

You can check it out here...

here is my code and if u need something else please ask me

$(document).ready(function () {

    var hash = window.location.hash.substr(1);
    var href = $('.kwicksC li a , .footerContainer li a').each(function () {
        var href = $(this).attr('href');
        if (hash == href.substr(0, href.length - 4)) {
            var toLoad = hash + '.php .content';
            $('.content').load(toLoad)
        }
    });

    $('.kwicksC li a , .footerContainer li a').click(function () {

        var toLoad = $(this).attr('href') + '.content';
        $('.content').fadeOut('fast', loadContent);
        $('#load').remove();
        $('#mainHWrap').append('<span id="load">CARGANDO...</span>');
        $('#load').fadeIn('normal');
        window.location.hash = $(this).attr('href').substr(0, $(this).attr('href').length - 4);

        function loadContent() {
            $('.content').load(toLoad, '', showNewContent())
        }

        function showNewContent() {
            $('.content').fadeIn("slow", hideLoader());
        }

        function hideLoader() {
            $('#load').fadeOut('normal');
        }
        return false;
    });
});

Thank you for your help

A: 

You need to change these

function loadContent() {
        $('.content').load(toLoad,'',showNewContent())
    }
    function showNewContent() {
        $('.content').fadeIn("slow",hideLoader());
    }

to

function loadContent() {
        $('.content').load(toLoad,'',showNewContent)
    }
    function showNewContent() {
        $('.content').fadeIn("slow",hideLoader);
    }

I removed the parenthesis from the callback methods, because you were calling them instead of passing them as callbacks..

Gaby
Sorry this didn't work... When I do this its even worst... but thank you for your try...
Omegakenshin