i am using wordpress, and we have there dynamic sidebar. in the sidebar we have many widgets. what am i trying to do is to show the divis (widgets) that visible on the screen (onload - after the page is load). the others widgets will be hidden(opacity 0 or something like that) but when i will scroll i want that widget(that was not visible on screen) will appear in fade effect.
i using this code that hide all my sidebar block is on opacity 0 on load.
i need help to show always all widgets that is visible on screen and then make the fade effect on scroll to others.
thanks for help!
$(document).ready(function(){
tiles = $("#sidebar1 div").fadeTo(0, 0);
});
$(window).scroll(function(d,h) {
tiles.each(function(i) {
a = $(this).offset().top + $(this).height();
b = $(window).scrollTop() + $(window).height();
if (a < b) $(this).fadeTo(500,1);
});
});
the funcasion for scrolling is working. the problem is that when the page is full load my sidebar class that hold all widgets is on opacity 0 (like display:none). what i need is when the page load it will give opacity 1 to all widgets that visible on screen (for example 2 of 10 widgets). then when user will scroll it will show others widgets each by other with fade effect. thanks for help!