Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

JQuery fade

Name: Anonymous 2013-01-08 5:56

Hey /prog/,

Very noob starting programmer here.

I have a set of divs that fade out and fade in when their respective menulink is clicked. The first div should load automatically on pageload without any fades, and if no content is loaded there should only be a fade in effect.
Now I'm getting all of this done except for the instant load of the first div. When I load the page, no content is present, a fade out occurs and then the first div automatically fades in.
How can I make sure the first div I have automatically loads without any fades?

Current code:

$(document).ready(function() {

$('a').bind("click", function(){

$('a').removeClass("actief");
$(this).addClass("actief");
var fade = $(this);

if($('#content').html()){
$(this).addClass("actief");
$('#content').stop().fadeTo(500,0,function(){
$('#content').html("").css('opacity', 0);
fade.next().clone().appendTo('#content');
$('#content').stop().fadeTo(500,1);
});
}

else{
$('#content').css('opacity', 0);
fade.next().clone().appendTo('#content');
$('#content').stop().fadeTo(500,1);
}
});

$('a:first').trigger('click');
});

Name: Anonymous 2013-01-08 8:21

Yeah I know it's amateuristic as fuck and looks like shit.
Point is this is a college assignment for a project collaboration between designers and programmers. Designers get a programming course too.
As you can tell I'm a designer so I don't know shit about programming, I'm astonished I get it so far.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List