/    Sign up×
Community /Pin to ProfileBookmark

Easy JQuery question.

Here’s my code for the sexy sliding bar, I just want the page to load with it extended (for users with no Javascript).

[code]
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() {})
});
[

[/code]

?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Jeff_MottJun 29.2009 — This has more to do with your styles than with JavaScript, since you're considering the case when JavaScript is unavailable. But you haven't shown us your styles or your markup. Your best bet for a helpful answer is to link to your actual page.
Copy linkTweet thisAlerts:
@ehimeauthorJun 29.2009 — Here's the page.

I got a quickie working to open it on load, but this still is hidden when

JavaScript is turned off unfortunetly. See it here: http://omnisistem.com

Thanks Jeff.
×

Success!

Help @ehime spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...