Skip to content

Commit bdea81d

Browse files
author
Niklaus Gerber
committed
Blocked Scrolling
Now scrolling is prevented while the loading animation is displayed. A big thanks to Sandro Melia for that input.
1 parent 9eebf6b commit bdea81d

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@ Place the following JavaScript code right before the `</body>` tag.
1717
<script type="text/javascript">
1818
//<![CDATA[
1919
$(window).load(function() { // makes sure the whole site is loaded
20-
$("#status").fadeOut(); // will first fade out the loading animation
21-
$("#preloader").delay(350).fadeOut("slow"); // will fade out the white DIV that covers the website.
20+
$('#status').fadeOut(); // will first fade out the loading animation
21+
$('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website.
22+
$('body').delay(350).css({'overflow':'visible'});
2223
})
2324
//]]>
24-
</script>
25+
</script>
2526

2627
### CSS
2728
Make sure you include the following CSS code on your website.
2829

30+
body {
31+
overflow: hidden;
32+
}
33+
2934
/* Preloader */
3035
#preloader {
31-
position:absolute;
36+
position: fixed;
3237
top:0;
3338
left:0;
3439
right:0;

css/styles.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
@charset "utf-8";
2+
body {
3+
overflow: hidden;
4+
}
25

36
/* Preloader */
47
#preloader {
5-
position:absolute;
8+
position: fixed;
69
top:0;
710
left:0;
811
right:0;

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
<script type="text/javascript">
3030
//<![CDATA[
3131
$(window).load(function() { // makes sure the whole site is loaded
32-
$("#status").fadeOut(); // will first fade out the loading animation
33-
$("#preloader").delay(350).fadeOut("slow"); // will fade out the white DIV that covers the website.
32+
$('#status').fadeOut(); // will first fade out the loading animation
33+
$('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website.
34+
$('body').delay(350).css({'overflow':'visible'});
3435
})
3536
//]]>
3637
</script>

0 commit comments

Comments
 (0)