Javascript.RU

Создать новую тему Ответ
 
Опции темы Искать в теме
  #1 (permalink)  
Старый 02.07.2014, 02:19
Аватар для Globus
Аспирант
Отправить личное сообщение для Globus Посмотреть профиль Найти все сообщения от Globus
 
Регистрация: 04.03.2014
Сообщений: 76

Слайды пустить по кругу
Есть очень классный скрипт
http://webformyself.com/sozdanie-kra...oshhyu-jquery/

Его демка
http://sixrevisions.com/demo/slideshow/final.html

И всё бы ничего, но там при прокрутке слайдов, когда они заканчиваются, пропадает правая кнопка, при прокрутке в обратном порядке - пропадает левая кнопка. Всё логично: нет слайдов - нечего и кнопке отображаться.

А мне надо, чтобы после последнего слайда опять шел первый, т.е. сколько не мотай в ту или иную сторону - слайды никогда не закончатся.

Подскажите, пожалуйста, как реализовать такой момент?
Ответить с цитированием
  #2 (permalink)  
Старый 02.07.2014, 02:39
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,070

Globus,
http://wowslider.com/ru/
Ответить с цитированием
  #3 (permalink)  
Старый 02.07.2014, 03:33
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,070

слайдер с бесконечной прокруткой
Globus,
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Slick jQuery Slidehow: Demo</title>
<style type="text/css">
/**
 * Slideshow style rules.
 */
#slideshow {
	margin:0 auto;
	width:640px;
	height:263px;
	background:transparent url(http://sixrevisions.com/demo/slideshow/img/bg_slideshow.jpg) no-repeat 0 0;
	position:relative;
}
#slideshow #slidesContainer {
  margin:0 auto;
  width:560px;
  height:263px;
  overflow:auto; /* allow scrollbar */
  position:relative;
}
#slideshow #slidesContainer .slide {
  margin:0 auto;
  width:540px; /* reduce by 20 pixels of #slidesContainer to avoid horizontal scroll */
  height:263px;
}

/**
 * Slideshow controls style rules.
 */
.control {
  display:block;
  width:39px;
  height:263px;
  text-indent:-10000px;
  position:absolute;
  cursor: pointer;
}
#leftControl {
  top:0;
  left:0;
  background:transparent url(http://sixrevisions.com/demo/slideshow/img/control_left.jpg) no-repeat 0 0;
}
#rightControl {
  top:0;
  right:0;
  background:transparent url(http://sixrevisions.com/demo/slideshow/img/control_right.jpg) no-repeat 0 0;
}

/**
 * Style rules for Demo page
 */
* {
  margin:0;
  padding:0;
  font:normal 11px Verdana, Geneva, sans-serif;
  color:#ccc;
}
a {
  color: #fff;
  font-weight:bold;
  text-decoration:none;
}
a:hover {
  text-decoration:underline;
}
a img {border:2px solid #ccc;}
body {
  background:#393737 url(http://sixrevisions.com/demo/slideshow/img/bg_body.jpg) repeat-x top left;
}
#pageContainer {
  margin:0 auto;
  width:960px;
}
#pageContainer h1 {
  display:block;
  width:960px;
  height:114px;
  background:transparent url(http://sixrevisions.com/demo/slideshow/img/bg_pagecontainer_h1.jpg) no-repeat top left;
  text-indent: -10000px;
}
.slide h2, .slide p {
  margin:15px;
}
.slide h2 {
  font:italic 24px Georgia, "Times New Roman", Times, serif;
  color:#ccc;
  letter-spacing:-1px;
}
.slide img {
  float:right;
  margin:0 15px;
}
#footer {
  height:100px;
}
#footer p {
  margin:30px auto 0 auto;
  display:block;
  width:560px;
  height:40px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
	$(document).ready(function()
	  {
	    var currentPosition = 0;
	    var slideWidth = 560;
	    var slides = $('.slide');
	    var numberOfSlides = slides.length;
	    $('#slidesContainer').css('overflow', 'hidden');
	    slides
	    .wrapAll('<div id="slideInner"></div>')
	    .css(
	      {
	      'float': 'left',
	      'width': slideWidth
	      }
	    );
	    $('#slideInner').css('width', slideWidth * numberOfSlides);
	    $('#slideshow')
	    .prepend('<span class="control" id="leftControl">Clicking moves left</span>')
	    .append('<span class="control" id="rightControl">Clicking moves right</span>');
	    $('.control')
	    .on('click', function()
	      {
	        currentPosition = (this.id=='rightControl')? currentPosition+1: currentPosition-1;
	        currentPosition==numberOfSlides &&(currentPosition = 0, $('#slideInner').css({'marginLeft': slideWidth}));
	        currentPosition==-1 &&(currentPosition = numberOfSlides-1, $('#slideInner').css({'marginLeft': -numberOfSlides * slideWidth}));
	        $('#slideInner').animate(
	          {
	          'marginLeft': slideWidth*(-currentPosition)
	          }
	        );
	      }
	    );
	  }
	);
</script>
</head>
<body>
<div id="pageContainer">
  <h1><a href="http://sixrevisions.com/tutorials/javascript_tutorial/create-a-slick-and-accessible-slideshow-using-jquery/">Slick Slideshow using jQuery</a></h1>
  <!-- Slideshow HTML -->
  <div id="slideshow">
    <div id="slidesContainer">
      <div class="slide">
        <h2>Web Development Tutorial1</h2>
        <p><a href="http://sixrevisions.com/tutorials/web-development-tutorials/using-xampp-for-local-wordpress-theme-development/"><img src="http://sixrevisions.com/demo/slideshow/img/img_slide_01.jpg" alt="An image that says Install X A M P P for wordpress." width="215" height="145" /></a>If you're into developing web apps, you should check out the tutorial called "<a href="http://sixrevisions.com/tutorials/web-development-tutorials/using-xampp-for-local-wordpress-theme-development/">Using XAMPP for Local WordPress Theme Development</a>" which shows you how to set up a local testing server for developing PHP/Perl based applications locally on your computer. The example also shows you how to set up WordPress locally!</p>
      </div>
      <div class="slide">
        <h2>Grunge Brushes, Anyone?2</h2>
        <p><a href="http://sixrevisions.com/freebies/brushes/sr-grunge-free-high-resolution-photoshop-grunge-brushes/"><img src="http://sixrevisions.com/demo/slideshow/img/img_slide_02.jpg" width="215" height="145" alt="A thumbnail image that says S R grunge photoshop brushes 6 high resolution grunge brushes by six revisions." /></a>In this layout, I used <a href="http://sixrevisions.com/freebies/brushes/sr-grunge-free-high-resolution-photoshop-grunge-brushes/">SR Grunge</a>, which is a free set of high-resolution Photoshop brushes you can download here on Six Revisions.</p>
      </div>
      <div class="slide">
        <h2>How About Some Awesome Grunge Textures?3</h2>
        <p><a href="http://sixrevisions.com/freebies/textures/grunge-extreme-15-high-resolution-grunge-textures/"><img src="http://sixrevisions.com/demo/slideshow/img/img_slide_03.jpg" width="215" height="145" alt="A thumbnail image that says grunge extreme 15 free high resolution grunge textures six revisions." /></a>The texture used in this web page is from the Grunge Extreme Textures freebie set by JC Parmley released here on Six Revisions.</p>
        <p>You can head over to the <a href="http://sixrevisions.com/freebies/textures/grunge-extreme-15-high-resolution-grunge-textures/">Grunge Extreme</a> page to download the texture set or check out Six Revisions' <a href="http://sixrevisions.com/category/freebies/">freebie section</a> for even more goodies!</p>
      </div>
      <div class="slide">
        <h2>'Tis the End, My Friend.4</h2>
        <p><a href="http://sixrevisions.com/tutorials/photoshop-tutorials/how-to-create-a-slick-and-clean-button-in-photoshop/"><img src="http://sixrevisions.com/demo/slideshow/img/img_slide_04.jpg" width="215" height="145" alt="Thumbnail image that says sleek button using photoshop that links to a Photoshop tutoril." /></a>This is the last slide. Hit the left arrow control to go back to the other slides.</p>
        <p>Alternatively, you may want to check out the tutorial on how to create a simple and cool button in Photoshop called &quot;<a href="http://sixrevisions.com/tutorials/photoshop-tutorials/how-to-create-a-slick-and-clean-button-in-photoshop/">How to Create a Slick and Clean Button in Photoshop</a>&quot; which was inspired by the <a href="http://www.campaignmonitor.com/designer/?utm_source=sixrevisions&amp;utm_medium=banner&amp;utm_term=2&amp;utm_content=0003&amp;utm_campaign=Apr09Banners">Campaign Monitor</a> web interface.</p>
      </div>
    </div>
  </div>
  <!-- Slideshow HTML -->
  <div id="footer">
    <p><a href="http://sixrevisions.com/tutorials/javascript_tutorial/create-a-slick-and-accessible-slideshow-using-jquery/">Create a Slick and Accessible Slideshow Using  jQuery</a> by Jacob Gube (<a href="http://sixrevisions.com/">Six Revisions</a>)</p>
  </div>
</div>
</body>
</html>

Последний раз редактировалось рони, 15.10.2017 в 19:47.
Ответить с цитированием
  #4 (permalink)  
Старый 16.07.2014, 01:26
Аватар для Globus
Аспирант
Отправить личное сообщение для Globus Посмотреть профиль Найти все сообщения от Globus
 
Регистрация: 04.03.2014
Сообщений: 76

идеально! спасибо за помощь!
Ответить с цитированием
  #5 (permalink)  
Старый 16.07.2014, 08:02
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,070

Сообщение от Globus
идеально!
можно сделать лучше )))
Ответить с цитированием
Ответ



Опции темы Искать в теме
Искать в теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
движение картинок по кругу zikworld Элементы интерфейса 15 16.05.2016 22:30
Элемнты не двигаются по кругу дальше угла pi/2 Synov_son Events/DOM/Window 10 05.02.2014 01:17
Функция для перевода размера из байтов в понятный для человека формат Антон Крамолов Ваши сайты и скрипты 4 05.04.2013 16:42
Смена цвета текста по кругу! JS_Den Общие вопросы Javascript 4 18.02.2012 14:39
Нужно что бы слайдер прокручивался по кругу sembler jQuery 0 29.06.2011 17:39