javascript - Disable scrolling of a window in jQuery - Stack Overflow

I am using something like facebox, and want the main window scrolling bar to be disabled.One catch tho

I am using something like facebox, and want the main window scrolling bar to be disabled. One catch though, There is a scroll bar inside the facebox ponent, which needs to be able to scroll.

What I am trying to fix is the following case:

when scrolling the internal scrolling element (inside facebox), when scroll ends, it scrolls the page down further.

I am using something like facebox, and want the main window scrolling bar to be disabled. One catch though, There is a scroll bar inside the facebox ponent, which needs to be able to scroll.

What I am trying to fix is the following case:

when scrolling the internal scrolling element (inside facebox), when scroll ends, it scrolls the page down further.

Share Improve this question asked Apr 1, 2011 at 3:11 IzzyCooperIzzyCooper 5961 gold badge5 silver badges15 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

do it in css:

body {
   overflow: hidden;
}

this would hide the scrollbar in the main window

i went into the facebox.js file and added

  $('body').css('overflow', 'hidden');

to

loading: function() {
      init()
      if ($('#facebox .loading').length == 1) return true
      showOverlay()
      $('#facebox .content').empty()
$('body').css('overflow', 'hidden');
      $('#facebox .body').children().hide().end().
        append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')

and added $('body').css('overflow', ''); to the end of the document

   * Bindings
   */

  $(document).bind('close.facebox', function() {
    $(document).unbind('keydown.facebox')
    $('#facebox').fadeOut(function() {
      $('#facebox .content').removeClass().addClass('content')
      $('#facebox .loading').remove()
      $(document).trigger('afterClose.facebox')
$('body').css('overflow', '');
    })
    hideOverlay()
  })

})(jQuery);

This stops the scroll when open and when closed put the scroll back in, it worked for me at http://www.vestedutility..au/home_electrical_saftey_check.php

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744737909a4590859.html

相关推荐

  • javascript - Disable scrolling of a window in jQuery - Stack Overflow

    I am using something like facebox, and want the main window scrolling bar to be disabled.One catch tho

    2天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信