From The Blog

jQuery Colorbox: Hide background page vertical scroll bar on open

28 October 2013, in

To hide the scroll bar of the background page when the colorbox opens "like facebook for example"


/* make the page scroll dissapear when colorbox is open and retrieved back when colorbox is closed */
var screen_position;
$(document).bind('cbox_open', function() {
screen_position = $("body").scrollTop();
$('body').css({ overflow: 'hidden' });
}).bind('cbox_closed', function() {
$('body').css({ overflow: 'auto' });

Post a Comment