Customizing the Scroll of a div

Asked

Viewed 166 times

3

As there are many resolutions from several different devices, I’m having a hard time displaying a feed list. Follows an image of how I think best to display such a DIV (list), in view that the page is responsive and it is not trivial to put a scroll-bar on a mobile device.

container-feed

Correction of the image: Scroll Buttom**

  • And do you want a script that does it right? in simple javascript or can it be with jquery or Mootools? Have you tried any code? give an example of your HTML?

  • I tried to do it only with CSS. I certainly did not succeed rsr. It can be Jquery yes! u

2 answers

4


Here’s a handmade example:

$('div.img img').on('click', function () {
    var scrollDIV = $('#scrollDIV');
    var scrollAtual = scrollDIV.scrollTop();
    var novoScroll = scrollAtual + ($(this).hasClass('up') ? -200 : 200);
        scrollDIV.animate({
            scrollTop: novoScroll + 'px'
        }, 1500);
});

Example

2

The ideal is that you make use of some library, developing some would not be so complicated, however, there are already numerous available in the market.

My tip for you would be to use the vertical jquery Carousel

Browser other questions tagged

You are not signed in. Login or sign up in order to post.