THT Community (TCom)

Full Version: jQuery Slide
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was wondering what jQuery plugin you were using for the sliding effects are your homepage. I'd love to have that on my site! Cool
Its just an combo of $.get() and the slide effect, I know how it works Wink
I don't think that its an plugin.
Could you show me how it works? I'd really love to use this. Big Grin
If Jonny allows me to do so...Get on IRC. I will explain it.
Sure, you can do that.
Code:
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var page2;
var old;
function page(url) {
old = page2;
if(old == null) {
old = "home";
}
page2 = url;
if(page != old) {
document.getElementById("nav_"+old).setAttribute("class", "none");
$.get(url+".html", function(data) {
document.getElementById("nav_"+page2).setAttribute("class", "active");
if(document.getElementById("content").style.display == "none") {
document.getElementById("content").innerHTML = '<div class="maintxt">'+data+'</div>';
$("#content").slideDown(1000);
}
else {
$("#content").slideUp(1000, function() {
document.getElementById("content").innerHTML = '<div class="maintxt">'+data+'</div>';
$("#content").slideDown(1000);
});
}
});
}
}
$(window).load(function () {
var urlpage = gup("page");
if(urlpage != "") {
page(urlpage);
}
else {
page('home');
}
});

OK. I got that into the head of my page. But how do I change it to work with my page? Cause, I tried but it didn't work right. Tongue
Kevin, that code isn't really general code. It's very specific to the THT website and what it needs. I'd suggest you look at this:
http://docs.jquery.com/Effects/slideTogg...edcallback
Thanks, Jonny. I'll take a look at that. Big Grin
Hmmmmm
Can you teach me how to use? I really want to use this...



--------------------------------------
dexter seasons 1-5 dvd boxset
the office seasons 1-7
Reference URL's