-
-
Save jameswquinn/6fa1659eba56bda59412140158ab24d2 to your computer and use it in GitHub Desktop.
Vue Carousel - Navigation example (source: https://jsfiddle.net/toddlawton/46wegz8a/?utm_source=website&utm_medium=embed&utm_campaign=46wegz8a)
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
const buildSlideMarkup = (count) => { | |
let slideMarkup = ''; | |
for (var i = 1; i <= count; i++) { | |
slideMarkup += '<slide><span class="label">' + i + '</span></slide>' | |
} | |
return slideMarkup; | |
}; | |
new Vue({ | |
el: '#example', | |
components: { | |
'carousel': VueCarousel.Carousel, | |
'slide': VueCarousel.Slide | |
}, | |
template: '<div><carousel :navigationEnabled="true">' + buildSlideMarkup(10) + '</carousel></div>' | |
}); |
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
#container { | |
padding: 0 60px; | |
} | |
.VueCarousel-slide { | |
position: relative; | |
background: #42b983; | |
color: #fff; | |
font-family: Arial; | |
font-size: 24px; | |
text-align: center; | |
min-height: 100px; | |
} | |
.label { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
} |
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
<div id="container"> | |
<div id="example"></div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment