Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // import jquery from code.jquery.com
- <script src="http://code.jquery.com/jquery-1.11.1.js">
- </script>
- // your code
- <script>
- jQuery(document).ready(function ($) {
- $('#checkbox').change(function(){
- setInterval(function () {
- moveRight();
- }, 3000);
- });
- var slideCount = $('#slider ul li').length;
- var slideWidth = $('#slider ul li').width();
- var slideHeight = $('#slider ul li').height();
- var sliderUlWidth = slideCount * slideWidth;
- $('#slider').css({ width: slideWidth, height: slideHeight });
- $('#slider ul').css({ width: sliderUlWidth, marginLeft: - slideWidth });
- $('#slider ul li:last-child').prependTo('#slider ul');
- function moveLeft() {
- $('#slider ul').animate({
- left: + slideWidth
- }, 200, function () {
- $('#slider ul li:last-child').prependTo('#slider ul');
- $('#slider ul').css('left', '');
- });
- };
- function moveRight() {
- $('#slider ul').animate({
- left: - slideWidth
- }, 200, function () {
- $('#slider ul li:first-child').appendTo('#slider ul');
- $('#slider ul').css('left', '');
- });
- };
- $('a.control_prev').click(function () {
- moveLeft();
- });
- $('a.control_next').click(function () {
- moveRight();
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement