Roll the page vertically wait and roll again

0

I have a page in PHP that reads an XML with an RSS, I would like to know if there is any way I scroll the page until the second RSS appears and then continue until the next RSS successively.

See page: link

While scrolling, you can see other RSS feeds below.

Another option would be a way for me to load the first RSS, then delete it and the second appears, and so on.

    
asked by anonymous 19.07.2015 / 05:34

1 answer

1

You have problems with HTML that you have to fix.

Remember that IDs must be unique. So instead of

<div id='corpo'>
    <div id='foto'>
        <img id="foto"

You should use classes and switch to:

<div class='corpo'>
    <div class='foto'>
        <img class="foto"

In your HTML there is another problem that is some divs are not closed. The% s of% are falling within themselves.

Regarding your scrolling question you can do this by using classes:

var $noticias = $('.corpo');
var qtd = $noticias.length;
var i = 0;
setInterval(function () {
if ((i++) == qtd) i = 0;
    $('html, body').animate({
        scrollTop: $noticias.eq(i).position().top
    }, 800); // <--- velocidade do scroll

}, 2000);  // <--- tempo de espera entre cada imagem

jsFiddle: link

    
20.07.2015 / 10:38