Hi everybody, i am trying to figure something out in jQuery and yes you may see now horrible code but i am not a programming expert ;-) So sorry if it hurts your eyes... But to describe the problem:
I have a div positioning working which gets fired by the scroll-event. What happens it that the scroll event gets fired a bunch of times which results in a flickering div. My plan is to fade out that div and fade back in as soon as no more scroll event is fired... How can i check that scrolling is over? I thought about a combination of timeout <-> scroll but actually nothing worked as i hoped... Heres what i got so far... Quite simple...
$(document).ready(function(){
//var animActive = false;
$(window).scroll(function() {
/*
if (animActive == false){
animActive = true;
$('.mceExternalToolbar').fadeOut(100, function () {
$('.mceExternalToolbar').fadeIn(3000, function () {
animActive = false;
console.log("NOW");
});
});
}*/
topParentx = $('#tinyMCEwrapper').position().top;
if ($(this).scrollTop() >= topParentx){
$('.mceExternalToolbar').css('top', ($(this).scrollTop()-topParentx) + "px");
} else {
$('.mceExternalToolbar').css('top', "0px");
};
});
});
As you can see i left one of my last attempts in there but its quite a noobish solution and by the way... The callbacks of the fade--fcuntion didnt work as expected...
THANKS IN ADVANCE FOR ANY HELP
Kind regards, Bosh