How to use 'owl carousel vertical slider' in JavaScript

Every line of 'owl carousel vertical slider' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
37function Carousel(el, options) {
38 /**
39 * Reference to context of an instance.
40 * @type {Object}
41 * @private
42 */
43 var that = this;
44
45 this._init(el, options);
46
47 if (this.initialize !== undefined) {
48 /**
49 * If you define an initialize method, it will be executed when a new Carousel is created.
50 * @memberof! ch.Carousel.prototype
51 * @function
52 */
53 this.initialize();
54 }
55
56 /**
57 * Event emitted when the component is ready to use.
58 * @event ch.Carousel#ready
59 * @example
60 * // Subscribe to "ready" event.
61 * carousel.on('ready', function () {
62 * // Some code here!
63 * });
64 */
65 window.setTimeout(function () { that.emit('ready'); }, 50);
66}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

120function VerticalCarousel(container) {
121
122 this.container = $(container);
123 this.currentPage = 1;
124 this.items = this.container.find('> li');
125 this.numItems = this.items.length;
126 this.singleHeight = $(this.items[0]).height();
127 this.numVisible = 3; //Math.ceil(this.container.height() / this.singleHeight);
128 this.numPages = Math.ceil(this.numItems / this.numVisible);
129 this.prevButton = $('<a class="arrow prev">^</a>');
130 this.nextButton = $('<a class="arrow next">&gt;</a>');
131 this.container.before(this.prevButton);
132 this.container.after(this.nextButton);
133 this.interval = false;
134
135 // Totally boss repeat hack.
136 function repeat(str, n) {
137 return new Array( n + 1 ).join( str );
138 }
139
140 // Pad out the last page if necessary.
141 var padAmount = this.numItems % this.numVisible;
142 if (padAmount > 0) {
143 this.container.append(repeat('<li style="height:' + this.singleHeight + 'px" class="empty" />', padAmount));
144 this.items = this.container.find('> li');
145 }
146
147 this.items.filter(':first').before(this.items.slice(-this.numVisible).clone().addClass('cloned'));
148 this.items.filter(':last').after(this.items.slice(0, this.numVisible).clone().addClass('cloned'));
149 this.items = this.container.find('> li');
150
151 this.container.scrollTop(this.singleHeight * this.numVisible);
152
153}

Related snippets