Fiido Firdauz Fiido Firdauz - 6 months ago 26
Javascript Question

infinite looping using scroll overflow-x

Target to achieve

I manage to make a result using overflow-y infinite looping,

i'm trying to make something different

What i'm trying to do is when the user scrolling overflow-x and the width document will increase +++ .

But the result that i get right now is the height of document are increase.

JS

$(window).scroll(function () {
if ($(window).scrollLeft() >= $(document).width() - $(window).width() - 10) {
setTimeout(function() {
var box = $("#scrollbox");
var aj = $(".set");
box.html(box.html() + aj.html());

}, 100);
}
});


Please help me.

Your help really appreciate

Here is the DEMO

Answer

You need to change your style to be like this:

p{
  display:inline-block;
  margin:0 80px;
}

.test{
    white-space: nowrap;
    text-overflow: ellipsis;
}

Demo : https://jsfiddle.net/IA7medd/u00fqtec/

Comments