D
D
Dc8882015-10-12 20:02:51
JavaScript
Dc888, 2015-10-12 20:02:51

How to make it so that when scrolling, the block that fits to the end of the browser window is fixed?

The essence of the question is that the content is divided into two parts - vertical, one part is longer than the other,
how to make it so that when scrolling the page, one of the parts is fixed when it ends, or approaches the footer of the browser window itself, facebook example

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Goryachev, 2015-10-12
@webirus

leafo.net/sticky-kit

D
Dc888, 2015-10-13
@Dc888

so far there is but very damp

jQuery(function($) {
  function fixDiv() {
    var $cache = $('#cont');
    if ($(window).scrollTop() >=  $(window).height())
      $cache.css({
    'position' : 'fixed',
    'top': 'auto',
    'bottom': 0,
    'left': 595,
    '-webkit-transform' : 'translateZ(0)',
      });
    else
      $cache.css({
    'position' : 'absolute',
    'top' : 0,
    'bottom' : 'auto',
    'left': 482,
      });
  }
  $(window).scroll(fixDiv);
  fixDiv();
});

J
jlekapb, 2015-10-13
@jlekapb

as an option
https://github.com/garand/sticky

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question