Skip to content

Instantly share code, notes, and snippets.

@tarunranka
Created October 2, 2015 11:09
Show Gist options
  • Save tarunranka/a128f3ae627a5591b490 to your computer and use it in GitHub Desktop.
Save tarunranka/a128f3ae627a5591b490 to your computer and use it in GitHub Desktop.
disableScrolling: function() {
var that= this;
var body = $('body');
var oWidth = body.outerWidth(true);
body.addClass('themodal-lock');
var sbWidth = body.outerWidth(true) - oWidth;
if (that.isIE()) {
that.ieBodyTopMargin = body.css('margin-top');
body.css('margin-top', 0);
}
if (sbWidth != 0) {
var tags = $('html, body');
tags.each(function () {
var $this = $(this);
that.oMargin[$this.prop('tagName').toLowerCase()] = parseInt($this.css('margin-right'));
});
$('html').css('margin-right', that.oMargin['html'] + sbWidth);
//$('.popup-bck').css('left', 0 - sbWidth);
}
},
enableScrolling: function() {
var that= this;
if (that.isIE()) {
$('body').css('margin-top', that.ieBodyTopMargin);
}
var body = $('body');
var oWidth = body.outerWidth(true);
body.removeClass('themodal-lock');
var sbWidth = body.outerWidth(true) - oWidth;
if (sbWidth != 0) {
$('html, body').each(function () {
var $this = $(this);
$this.css('margin-right', that.oMargin[$this.prop('tagName').toLowerCase()])
});
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment