开发者

jquery links fade in/out

I am trying to get my wordpress internal links to appear in a content div, instead of doing a normal page reload. The fade in/out is working correctly, but the div content is not changing. Firebug is showing no errors, and all internal links are now only adding "#/" to the page link, how would I make sure the link is correctly being added back in with jquery? Thanks in advance,

P.S, I am following the "css-tricks: ajaxing a wordpress theme" video if that helps,

    $(function() {

        $(".home li.home").removeClass("home").addClass("current_page_item");
        var $mainContent = $("#content"),

            URL = '',
            siteURL = "http://" + top.location.host.toString(),
            $internalLinks = $("a[href^='"+siteURL+"']"),
            hash = window.location.hash,
            $el, $allLinks = $("a");

        if (hash) {
            $mainContent.animate({ opacity: "0.1" });
            $(".current_page_item").removeClass("current_page_item");
            $("a[href="+hash+"]").addClass("current_link").parent().addClass("current_page_item");
            hash = hash.substring(1);
            URL = hash + " #content";
            $mainContent.load(URL, function() {
                $mainContent.animate({ opacity: "1" });
            });
        }

        $internalLinks.each(function() {
            $(this).attr("href", "#" + this.pathname);
        }).click(function() {
            $mainContent.animate({ opacity: "0.1" });
            $el = $(thi开发者_JAVA技巧s);
            $(".current_page_item").removeClass("current_page_item");
            $allLinks.removeClass("current_link");
            URL = $el.attr("href").substring(1);
            URL = URL + " #content";
            $mainContent.load(URL, function() {
                $el.addClass("current_link").parent().addClass("current_page_item");
                $mainContent.animate({ opacity: "1" });
            });

        });
});


Can you put in console.log(variableName) in your method and see if the output of the variable in firebug is what you expect?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜