рд╕рд░рд▓ рд▓рдВрдмрди рд╕реНрдХреНрд░реЙрд▓рд┐рдВрдЧ рддрдХрдиреАрдХ

рд╢реБрдн рджрд┐рди рдкреНрд░рд┐рдп habrayuzeryред рдЖрдЬ рд▓рдВрдмрди рд╕реНрдХреНрд░реЙрд▓рд┐рдВрдЧ рдПрдХ рддрд░рд╣ рдХрд╛ рдЪрд▓рди рд╣реИ рдФрд░ рдореИрдВ рдЗрд╕ рдЖрд╢рдп рдХреЗ рдПрдХ рд╕рд░рд▓ рдХрд╛рд░реНрдпрд╛рдиреНрд╡рдпрди рдХреЗ рдмрд╛рд░реЗ рдореЗрдВ рдмрд╛рдд рдХрд░рдирд╛ рдЪрд╛рд╣рддрд╛ рд╣реВрдВред рддрдХрдиреАрдХ background-position рд╕рдВрдкрддреНрддрд┐ рдХреЗ рдкрд░рд┐рд╡рд░реНрддрди рдХреА рджрд░ рдкрд░ рдЖрдзрд╛рд░рд┐рдд рд╣реИред рд▓рдВрдмрди рд╕реНрдХреНрд░реЙрд▓рд┐рдВрдЧ рдХрд╛ рдкреНрд░рднрд╛рд╡ рдпрд╣ рд╣реИ рдХрд┐ рдкреГрд╖реНрдарднреВрдорд┐ рд╕рд╛рдордЧреНрд░реА рдХреА рддреБрд▓рдирд╛ рдореЗрдВ рдзреАрдореА рдЧрддрд┐ рд╕реЗ рдЪрд▓рддреА рд╣реИ

HTML рдорд╛рд░реНрдХрдЕрдк


рд╣рдо "data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
рджреЛ рдмреНрд▓реЙрдХ рдмрдирд╛рддреЗ рд╣реИрдВ "data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
   "data-type"  "data-speed" : 
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.

"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.

"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
   "data-type"  "data-speed" : 
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
   "data-type"  "data-speed" : 
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.

"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.

"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
   "data-type"  "data-speed" : 
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
   "data-type"  "data-speed" : 
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
   "data-type"  "data-speed" : 
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
   "data-type"  "data-speed" : 
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
   "data-type"  "data-speed" : 
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.
"data-type" "data-speed" :
<section id="home" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section> <section id="about" data-type="background" data-speed="10" class="pages"> <article> Parallax Scrolling</article> </section>
JavaScript, data-type .


CSS
id #home #about
#home { background: url(home-bg.jpg) center 0 repeat fixed; min-height: 1200px; } #about { background: url(about-bg.jpg) center 0 no-repeat min-height: 1200px; }
home-bg.jpg
30efa81c4067e1a308e5bd8b431

about-bg.jpg
Netcribe

:
#home { background: url(home.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; } #home article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; } #about { background: url(about.jpg) center 0 repeat fixed; min-height: 1000px; height: 1000px; margin: 0 auto; width: 100%; max-width: 1920px; position: relative; -webkit-box-shadow: 0 0 50px rgba(0,0,0,0.8); box-shadow: 0 0 50px rgba(0,0,0,0.8); } #about article { height: 458px; position: absolute; text-align: center; top: 300px; width: 100%; }

JavaScript - jQuery
data-type="background" :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // }); });
.scroll() .each() , :
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { ... }); }); });
:
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));
Netcribe

background-position coords :
var coords = 'center '+ yPos + 'px'; $bgobj.css({ backgroundPosition: coords });

:
$(document).ready(function(){ $('section[data-type="background"]').each(function(){ var $bgobj = $(this); // $(window).scroll(function() { var yPos = -($window.scrollTop() / $bgobj.data('speed')); // // background-position var coords = 'center '+ yPos + 'px'; // Parallax Scrolling $bgobj.css({ backgroundPosition: coords }); }); }); });

.


Source: https://habr.com/ru/post/In161875/


All Articles