Skip to content

Instantly share code, notes, and snippets.

@megabayt
Created November 2, 2017 14:18
Show Gist options
  • Save megabayt/996a958e90eea890c0a11138b2c976e1 to your computer and use it in GitHub Desktop.
Save megabayt/996a958e90eea890c0a11138b2c976e1 to your computer and use it in GitHub Desktop.
Owl slideshow preview
<div class="bigCont">
<img src="//lorempixel.com/500/500" />
</div>
<div class="smallCont">
<ul class="list-inline" style="list-style: none">
<li style="display: inline-block"><a href="//lorempixel.com/500/500"><img src="//lorempixel.com/100/100" alt=""></a></li>
<li style="display: inline-block"><a href="//lorempixel.com/500/500"><img src="//lorempixel.com/100/100" alt=""></a></li>
<li style="display: inline-block"><a href="//lorempixel.com/500/500"><img src="//lorempixel.com/100/100" alt=""></a></li>
<li style="display: inline-block"><a href="//lorempixel.com/500/500"><img src="//lorempixel.com/100/100" alt=""></a></li>
<li style="display: inline-block"><a href="//lorempixel.com/500/500"><img src="//lorempixel.com/100/100" alt=""></a></li>
<li style="display: inline-block"><a href="//lorempixel.com/500/500"><img src="//lorempixel.com/100/100" alt=""></a></li>
<li style="display: inline-block"><a href="//lorempixel.com/500/500"><img src="//lorempixel.com/100/100" alt=""></a></li>
<li style="display: inline-block"><a href="//lorempixel.com/500/500"><img src="//lorempixel.com/100/100" alt=""></a></li>
</ul>
</div>
<script>
$('.smallCont ul').owlCarousel()
$('.smallCont a').click(function(e){
e.preventDefault()
//Удалить активные кнопки
$('.smallCont a').removeClass('active');
$('.bigCont img').attr('src', $(this).attr('href'));
//добавить класс active
$(this).addClass('active');
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment