...

View Full Version : Easy JQuery question.



ehime
06-29-2009, 05:01 PM
Here's my code for the sexy sliding bar, I just want the page to load with it extended (for users with no Javascript).



var isExtended = 0;
var width = 200;
var height = "100%";
var slideDuration = 1000;
var opacityDuration = 1500;
function extendContract() {
if (isExtended == 0) {
sideBarSlide(0, height, 1, width);
sideBarOpacity(0, 1);
isExtended = 1;
$("#sideBarTab").children().get(0).src = $("#sideBarTab").children().get(0).src.replace(/(\.[^.]+)$/, "-active$1")
} else {
sideBarSlide(height, 0, width, 1);
sideBarOpacity(1, 0);
isExtended = 0;
$("#sideBarTab").children().get(0).src = $("#sideBarTab").children().get(0).src.replace(/-active(\.[^.]+)$/, "$1")
}
}


function sideBarSlide(b, a, c, d) {
$("sideBarContents").css({
height: b,
width: c
});
$("#sideBarContents").animate({
height: a,
width: d
},
{
queue: false,
duration: slideDuration
},
"linear")
}
function sideBarOpacity(b, a) {
$("#sideBarContents").animate({
opacity: a
},
opacityDuration, "linear")
}
$(function() {
$("#sideBarTab").click(function() {
extendContract();
return false
},
function() {})
});
[



:thumbsup:

awatson
06-29-2009, 08:47 PM
Just put whatever you want the "default" settings for it to be in your stylesheet - they'll get overridden by the javscript (when it's triggered) but will control the display for people not running javascript.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum