Created
June 1, 2014 11:44
-
-
Save ronihcohen/64e80d617f791eb811e5 to your computer and use it in GitHub Desktop.
Quick guide div auto scroll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.guide-container{ | |
height: 450px; | |
width: 750px; | |
overflow-x: scroll; | |
overflow-y: hidden; | |
direction: rtl; | |
} | |
.guide-container::-webkit-scrollbar-track | |
{ | |
background-color: #231f20; | |
} | |
.guide-container::-webkit-scrollbar | |
{ | |
background-color: #231f20; | |
} | |
.guide-container::-webkit-scrollbar-thumb | |
{ | |
background-color: #f68022; | |
} | |
</style> | |
<div class="guide-container" onclick="nextSlide('left')"> | |
<img src="init.png"> | |
</div> | |
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script> | |
var guide = $(".guide-container"); | |
var slide = 0; | |
function nextSlide(direction){ | |
if (direction=='left' &&slide!=3) slide++; | |
else slide=0; | |
// if (direction=='right'&&slide>0) slide--; | |
switch(slide) { | |
case 0: | |
jumpTo =2259; | |
break; | |
case 1: | |
jumpTo =1500; | |
break; | |
case 2: | |
jumpTo =770; | |
break; | |
case 3: | |
jumpTo =0; | |
break; | |
} | |
guide.animate({scrollLeft:jumpTo}, '5000', 'swing'); | |
} | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment