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

Pages: 1-

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 6:41

Nah.

Name: Anonymous 2013-01-08 6:55

This isn't Racket, so go away.

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-01-08 7:49

fade out and fade in
This is the most distracting stuff ever and makes the user think the site is slower than it really is.

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.

Name: Anonymous 2013-01-08 9:05

>>5
Get the fuck out.
And die.
In a fire.
Fucking cretin.

Name: Anonymous 2013-01-08 9:39

Name: Anonymous 2013-01-08 9:42

I read that as JQuery fad.

Now fuck off, Javashit nigger.

Name: Anonymous 2013-01-08 9:46

>>8
What happened to JavaShit users being kikes?

Name: Anonymous 2013-01-08 9:52

>>9
I don't know, but your antisemite posts are much more relevant and entertaining than your usual crap.

Name: Anonymous 2013-01-08 9:58

>>10
I already know, you don't have to tell me.

Name: Anonymous 2013-01-08 10:08

>>11
One day we'll be friends and laugh about this. Although, I am pretty sure we already discussed politely on some mailing lists

Name: Anonymous 2013-01-08 10:09

>>12
Maybe we did.

Name: Anonymous 2013-01-08 20:26

$(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');
});

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