// Allow scrolling again
$("body").css({
"overflow":"auto"
});
The script author ignores the initial setting the web page author selected and overwrites it. Worse, in the comment the script author assumes that this is what the web page author meant.
The script should instead save the initial value to a variable and restore from there.
This might be problematic where browsers do not allow you to read the initial value. An option then could be to allow the user to pass the value as an argument. The default should then be, in my opinion, CSS's default, i.e. 'visible', not 'auto'.
At the end of the script it says:
// Allow scrolling again $("body").css({ "overflow":"auto" });
The script author ignores the initial setting the web page author selected and overwrites it. Worse, in the comment the script author assumes that this is what the web page author meant.
The script should instead save the initial value to a variable and restore from there.
This might be problematic where browsers do not allow you to read the initial value. An option then could be to allow the user to pass the value as an argument. The default should then be, in my opinion, CSS's default, i.e. 'visible', not 'auto'.