Jump to content
Sign in to follow this  
Sign33444

Остановка при наведении Slidershow / opencart3

Recommended Posts

Всем привет!

У меня возникла небольшая проблема с внесением функции остановки слайдера при наведении.

Сам слайдер: 

<div class="swiper-viewport">
  <div id="slideshow{{ module }}" class="swiper-container">
    <div class="swiper-wrapper"> {% for banner in banners %}
      <div class="swiper-slide text-center">{% if banner.link %}<a href="{{ banner.link }}"><img src="{{ banner.image }}" alt="{{ banner.title }}" class="img-responsive" /></a>{% else %}<img src="{{ banner.image }}" alt="{{ banner.title }}" class="img-responsive" />{% endif %}</div>
      {% endfor %} </div>
  </div>
  <div class="swiper-pager">
    <div class="swiper-button-next"></div>
    <div class="swiper-button-prev"></div>
  </div>
</div>
<script type="text/javascript"><!--
$('#slideshow{{ module }}').swiper({
	mode: 'horizontal',
	slidesPerView: 1,
	pagination: '.slideshow{{ module }}',
	paginationClickable: true,
	nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev',
    spaceBetween: 30,
	autoplay: 4500,
    autoplayDisableOnInteraction: true,
	loop: true,
  effect: 'easeinout',
  speed: 1000,  
  }); 
--></script>

Пробывал несколько вариантов: 

stopOnHover: true

 и

<script>
$('#slideshow{{ module }}').swiper.hover(function()
  {
    $('#slideshow{{ module }}').swiper('stop');
  }, function(){
    $('#slideshow{{ module }}').swiper('start');
  });

</script>

 

Возможно я не туда вставляю этот кусок кода, или как правильно?

скажите пожалуйста!) спасибо

  • +1 1

Share this post


Link to post
Share on other sites

Получилось все сделать.

тему можно закрывать

Вот рабочий код:

<div class="swiper-viewport">
  <div id="slideshow{{ module }}" class="swiper-container">
    <div class="swiper-wrapper"> {% for banner in banners %}
      <div class="swiper-slide text-center">{% if banner.link %}<a href="{{ banner.link }}"><img src="{{ banner.image }}" alt="{{ banner.title }}" class="img-responsive" /></a>{% else %}<img src="{{ banner.image }}" alt="{{ banner.title }}" class="img-responsive" />{% endif %}</div>
      {% endfor %} </div>
  </div>
  <div class="swiper-pager">
    <div class="swiper-button-next"></div>
    <div class="swiper-button-prev"></div>
  </div>
</div>
<script type="text/javascript"><!--
$('#slideshow{{ module }}').swiper({
	mode: 'horizontal',
	slidesPerView: 1,
	pagination: '.slideshow{{ module }}',
	paginationClickable: true,
	nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev',
    spaceBetween: 30,
	autoplay: 4500,
    autoplayDisableOnInteraction: true,
	loop: true,
  effect: 'EaseInOut',
  speed: 1000,  
  });
$('#slideshow{{ module }}').hover(function(){
     this.swiper.stopAutoplay();
}, function(){
     this.swiper.startAutoplay();
});  
--></script>

 

  • +1 1

Share this post


Link to post
Share on other sites
7 минут назад, Sign33444 сказал:

Вот рабочий код:

вот за это просто плюсище! все бы так делали)

Share this post


Link to post
Share on other sites
34 минуты назад, Pavel666 сказал:

вот за это просто плюсище! все бы так делали)

Спасибо) 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.