javascript - Scroll a CSS background when user scrolls the webpage - parallax? -


i've got page built - has small section include links social sites.

that section has nice background out of css - background 'scroll', while user scrolls or down sites page.

this parallax effect - i'm not sure if can done css background.

i've tried few tutorials here or there online without success.

i created codepen on basics of have

but here html:

<div id="social-row">   <div id="para-social-bg">     <div class="social-icons" id="para-social-shadow">       <h4>social stuff</h4>         <ul>           <li><a href="mytwitter" title="http://www.mytwitter.com" class="icon-social twitter">twitter</a></li>           <li><a href="http://www.myfacebook.com" title="me on facebook" class="icon-social facebook">facebook</a></li>           <li><a href="http://www.myblog.com" title="my news" class="icon-social atom">blog feed</a></li>           <li><a href="http://www.myinstagram.com" title="me on instagram" class="icon-social instagram">instagram</a></li>       </ul>     </div>   </div> </div> 

...and css:

#para-social-bg { background-color: #6d695c; background-image: repeating-linear-gradient(120deg, rgba(255,255,255,.1), rgba(255,255,255,.1) 1px, transparent 1px, transparent 60px), repeating-linear-gradient(60deg, rgba(255,255,255,.1), rgba(255,255,255,.1) 1px, transparent 1px, transparent 60px), linear-gradient(60deg, rgba(0,0,0,.1) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.1) 75%, rgba(0,0,0,.1)), linear-gradient(120deg, rgba(0,0,0,.1) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.1) 75%, rgba(0,0,0,.1)); background-size: 70px 120px;   }  #para-social-shadow { box-shadow:         inset 0 6px 10px -9px rgba(0,0,0,0.8),                     inset 0 -6px 10px -9px rgba(0,0,0,0.8); -moz-box-shadow:    inset 0 6px 10px -9px rgba(0,0,0,0.8),                     inset 0 -6px 10px -9px rgba(0,0,0,0.8); -webkit-box-shadow: inset 0 6px 10px -9px rgba(0,0,0,0.8),                     inset 0 -6px 10px -9px rgba(0,0,0,0.8);   } 

ultimately need argyle styling 'scroll' vertically user scrolls down page (but @ slower speed user scrolling page - appears 'behind' other sections above , below it).

any thoughts? open ideas - css, js, jquery - whatever.

css optimal, js can done without worry.

this can done javascript:

$(window).scroll(function(){   $("#para-social-bg").css({"background-position":"left " +($(window).scrolltop()*.5) + "px"}) }); 

http://codepen.io/anon/pen/qdrjxj


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -