I
I
IIIu6ko2018-02-06 23:37:39
css
IIIu6ko, 2018-02-06 23:37:39

How to make mobile table with gradient?

Can you please tell me how to achieve this effect?
wzchYR6aQTejVPgwB7SGDg.jpeg
As you scroll, the gradient disappears by itself.
UPD:
It just dawned on me that you can show this gradient until you scroll to the end of the table.
Please tell me how to do this in jquery.
Well, the gradient is some kind of after over the table.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IIIu6ko, 2018-02-08
@IIIu6ko

figured it out myself)

gradientTable();

  $(window).resize(function() {
    gradientTable();
  });

  function gradientTable() {
    var tableWidth = $(".table--delivery-method").width();
    var windowSize = $(window).width();
    var widthGradient = $(".table__gradient").width();
    var widthWindowWithoutIndentation = windowSize / 100 * 5;
    var primaryPositionGradient = windowSize - widthWindowWithoutIndentation - widthGradient;
    $(".table__gradient").css("left", primaryPositionGradient + "px");

    $(".table__box").scroll(function() {
      if($(this).scrollLeft() >= (tableWidth - windowSize + widthWindowWithoutIndentation)) {
        $(".table__gradient").fadeOut();
      }
      else {
        $(".table__gradient").fadeIn();
        $(".table__gradient").css("left", primaryPositionGradient + $(this).scrollLeft() + "px");
      }
    });
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question