The site has a modal window with info and in this modal window there is a scroll, so here, sometimes it happens that scrolling "jumps" onto the main document and scrolls it behind the modal window, instead of scrolling content in the window itself, but this is not good.

Hide the main scroll, too, does not roll for slightly moving the layout, ugly, some users in general can cause outrage. I have sketched a solution, but it works in a fox, figokhrom, from which the main audience shows off, I did not test in the opera

var scrllTop = $('html, body').scrollTop(); $(window).on('scroll.confirm', function(){ $(window).scrollTop(scrllTop); return false; }); 
  • He said he did not roll, the main frame has a margin: 0 auto; and if you hide the overflow that place which he held free, because of what all the content a little bit out. The users somehow complained to me about it, it creates the feeling that something "broke", and what is not clear - Fangog
  • How it is done Vkotntakte . Output: a) fixing sizes with javascript b) custom slider - Crasher
  • Nothing fits, then will have to accept) - Fangog

1 answer 1

When opening modal, write down the thread in $ .data (), for example, scrollTop for all elements that do not need to be scrolled, hang the document scroll event on document -> elements

 if ($(e.target).is('.modal') && e.target!==this) setTimeout(function(){ $this.scrollTop($.data($this).scrollTop) },0); 

In general, something in this spirit, make an example with modal, show.