IanPatrickBuss
10-27-2009, 07:57 PM
function jNav()
{
$(".menu a, .footer a").click(function()
{
var url = $(this).attr("href").split("#");
var url = url[1];
var x = 0;
var pages = new Array();
pages[0] = "header";
pages[1] = "content";
if(url=="home" || url=="services" || url=="portfolio" || url=="blog" || url=="contact")
{
$("body").animate(
{
backgroundPosition: "0px 0px"
}, 2000);
}
else
{
$("body").animate(
{
backgroundPosition: "-1000px 0px"
}, 2000);
}
for(x in pages)
{
text = $("." + pages[x] + " div.text");
loader = $("." + pages[x] + " img.loader");
text.fadeOut("slow", function ()
{
loader.fadeIn("slow", function ()
{
text.css("display", "none");
alert("pages/" + url + "/" + pages[x] + ".php");
text.load("pages/" + url + "/" + pages[x] + ".php", function ()
{
loader.fadeOut("slow", function ()
{
text.fadeIn("slow");
});
});
});
});
}
});
}
The yellow bit is where I am having a bit of trouble...
My intent is for the yellow bit to load two separate pages into two separate divs. Though, it is only loading it into the second one... this is a plugin I am working on for jQuery... This is my first experiment with the js function for()
Any help is good help! thanks!
{
$(".menu a, .footer a").click(function()
{
var url = $(this).attr("href").split("#");
var url = url[1];
var x = 0;
var pages = new Array();
pages[0] = "header";
pages[1] = "content";
if(url=="home" || url=="services" || url=="portfolio" || url=="blog" || url=="contact")
{
$("body").animate(
{
backgroundPosition: "0px 0px"
}, 2000);
}
else
{
$("body").animate(
{
backgroundPosition: "-1000px 0px"
}, 2000);
}
for(x in pages)
{
text = $("." + pages[x] + " div.text");
loader = $("." + pages[x] + " img.loader");
text.fadeOut("slow", function ()
{
loader.fadeIn("slow", function ()
{
text.css("display", "none");
alert("pages/" + url + "/" + pages[x] + ".php");
text.load("pages/" + url + "/" + pages[x] + ".php", function ()
{
loader.fadeOut("slow", function ()
{
text.fadeIn("slow");
});
});
});
});
}
});
}
The yellow bit is where I am having a bit of trouble...
My intent is for the yellow bit to load two separate pages into two separate divs. Though, it is only loading it into the second one... this is a plugin I am working on for jQuery... This is my first experiment with the js function for()
Any help is good help! thanks!