How to Set Different Scroll speed for Divs using Css and Jquery | Sanwebcorner

How to Set Different Scroll speed for Divs using Css and Jquery

This is one of the interesting concept to set the different scroll speed for different div. When you scroll each of the div moves based on the scroll speed you mentioned. For that you should include the JQuery file in the programs. The following code used to set the scroll speed each of the div.

<div class="box" data-scroll-speed="5">HTML</div>
<div class="box" data-scroll-speed="3">CSS</div>
<div class="box" data-scroll-speed="7">JAVASCRIPT</div>
<div class="box" data-scroll-speed="4">JQUERY</div>

I hope this topic will useful to you. Here we have the full code and also available the demo link of this program. Please check out the demo link for set the different scroll speed for each div. This types of concept is very useful somewhere in the programs.

How to set Different Scroll time for each div :

<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>jQuery different scroll speeds</title>
<style>
body {
font-family: arial, sans-serif;
}
.content {
height: 9000px;
}
.wrapper {
display: -webkit-box;
display: -moz-box;
display: box;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-moz-box-pack: center;
box-pack: center;
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-o-justify-content: center;
justify-content: center;
-ms-flex-pack: center;
-webkit-box-align: center;
-moz-box-align: center;
box-align: center;
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
align-items: center;
-ms-flex-align: center;
height: 100vh;
width: 100%;
position: fixed;
top: 0px;
left: 0px;
}

.box {
-webkit-box-flex: none;
-moz-box-flex: none;
box-flex: none;
-webkit-flex: none;
-moz-flex: none;
-ms-flex: none;
flex: none;
height: 150px;
width: 190px;
line-height: 150px;
text-align: center;
font-size: 25px;
color: #fff;
background: #ff8330;
margin:25px;
}
.box:nth-of-type(2) {
background: #E01B5D;
}
.box:nth-of-type(3) {
background: #179292;
}
.box:nth-of-type(4) {
background: #699817;
}
</style>
</head>
<body>
<div class="content">
<div class="wrapper">
<div class="box" data-scroll-speed="5">HTML</div>
<div class="box" data-scroll-speed="3">CSS</div>
<div class="box" data-scroll-speed="7">JAVASCRIPT</div>
<div class="box" data-scroll-speed="4">JQUERY</div>
</div>
</div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>



Post a Comment

Labels

360 degree view product image 3d rotate 3d text 3step-form Accordion menu ajax All Browsers Animated Background Gradient animation audio controller auto complete Best accordion menu bootstrap border bounce effect on hover Breadcrumb calculate age by dob calendar Captcha change image on mouse move color chooser countdown Counter on scroll create random number Css css animation css buttons css hover css3 customized upload Button Date picker delete data from table Different scroll speed email otp verification email verifier Embed eventlist Expanding Menu feedbck form flash news section close button full screen menu Google custom search Google Maps Google reCAPTCHA Google site search gradient hide menu Horizontal News ticker Hover Htm Html html dropdown html form html5 html5 form validation Iframe image hover increment decrement textbox value based on select box Javascript Jquery js Layered image effect on mouse hover lock & unlock page scroll marquee marquee with close button mobile number validation mobile otp login Multi-level-drop-down-menu multi-level-form Multi-Step-form mysql News ticker on hover change text to image our team page password generator password strength checker Photoshop PHP populate html selectbox Popup image on click the link pure css Question type form random number generate Random password Redirect page Based on the select box while submit the form responsive responsive menu responsive popup box Responsive Vertical Time line design rotate image selectbox based on select box simple coming soon page simple countdown based on end date simple typing effect slider sliding tab sms otp login statistic counter on scroll switch tag shape team member Time picker toggle toggle view transparent button underline animation up down slide validation vertical fixed sidebar Webtips Youtube