0

I'm using this code right now:

// JavaScript Document
$(document).scroll(function(){
    if($(document).scrollTop() >= 470) {
        $('div.slide-in-section1').effect('slide');
    }
});

And of course I did realize that whenever you scroll just a little more it will keep re-running this bit of code. But I figured I had a fix, which was this:

// JavaScript Document
$(document).scroll(function(){
    if($(document).scrollTop() >= 470) {
        $('div.slide-in-section1').effect('slide');
        $('div.slide-in-section1').delay(400).removeClass('slide-in-section1');
    }
});

But then literally nothing happened. So I'm figuring the delay is kind of being ignored or something... I don't know, just a guess. Anyways I'm just wanting a div to slide in when you scroll down to a certain point. But I don't want it to go away or re-run unless the page is reloaded. Would this be the right way to approach it or am I totally missing something?

3
Contributors
3
Replies
16
Views
2 Years
Discussion Span
Last Post by pixelsoul
0

delay is only for effect type calls

probably not the cleanest but this should work

$('div.slide-in-section1').effect('effect':'slide','complete':function(){$('div.slide-in-section1').removeClass('slide-in-section1');});
0

Alright so I used that code like so:

$(document).scroll(function(){
    if($(document).scrollTop() >= 470) {
        $('div.slide-in-section1').effect('effect':'slide','complete':function(){
            $('div.slide-in-section1').removeClass('slide-in-section1');
        });
    }
});

And got this log error:
Uncaught SyntaxError: missing ) after argument list on line 4

0

It would be more like this

$(document).scroll(function(){
    if($(document).scrollTop() >= 470) {
        $('div.slide-in-section1').effect('slide', 1000, function(){
            $('div.slide-in-section1').removeClass('slide-in-section1');
        });
    }
});

Edited by pixelsoul

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.