-
Notifications
You must be signed in to change notification settings - Fork 0
/
owl-carousel-custom-dots.html
207 lines (152 loc) · 7.4 KB
/
owl-carousel-custom-dots.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- derickruiz.com/responsive-calendar -->
<!-- It would be cool having the emoji either in the title or in the description. -->
<!-- A single emoji that represents what the post is about -->
<title>Custom dots with Owl Carousel 2 - Derick Ruiz</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Some custom description in here -->
<meta name="Description" content="">
<link rel="canonical" href="/owl-carousel-custom-dots">
<meta http-equiv="cleartype" content="on">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#ffffff">
<!-- Typekit code that loads nimbus sans -->
<script>
(function(d) {
var config = {
kitId: 'yhz0fyw',
scriptTimeout: 3000
},
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
})(document);
</script>
<link rel="stylesheet" href="/css/styles.css">
<link rel="stylesheet" href="/css/code.css">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-58696895-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body class='blog-post-page' itemscope="itemscope" itemprop="http://schema.org/WebPage">
<div class='wrapper'>
<section class='intro clearfix'><!-- Is intro the appropriate name for this section? -->
<nav class="clearfix" role="navigation" itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li class=''>
<a href="/about" itemprop="url">About</a>
</li>
<li class=''>
<a href="/articles" itemprop="url">Articles</a>
</li>
<li class=''>
<a href="/works" itemprop="url">Works</a>
</li>
<li class=''>
<a href="/contact" itemprop="url">Contact</a>
</li>
<li class="home-link" aria-hidden="true">
<a href="/"></a>
</li>
</ul>
</nav>
<a href="/"><!-- link to home page -->
<header itemscope itemtype="http://schema.org/Person">
<h3 class='name' itemprop="name">
<span itemprop="givenName">Derick</span> <span itemprop="familyName">Ruiz</span>
</h3>
</header>
</a>
</section>
</div>
<div class='wrapper wrapper--noSpacing'>
<!-- Put the item type of blog back inside of here -->
<main role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
<article itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<header>
<h1 class='hyphenate' itemprop="headline">Custom dots with Owl Carousel 2</h1>
<time itemprop="datePublished" datetime=2015-10-07>
<span class='month-day-year'>10.07.2015</span>
</time>
<span class='separator'>|</span>
<time class='read-time' itemprop="timeRequired" datetime="01M">
<span>01 minute read</span>
</time>
<meta itemprop="wordCount" content="62">
</header>
<div class='hyphenate content' itemprop="articleBody">
<p>Here is how you can get custom dot navigation in with <strong>Owl Carousel 2</strong>.</p>
<p>First create your dots container.</p>
<pre data-language="html">
<code data-language="html"><div id='carousel' class='owl-carousel'>
<div class='item'></div>
<div class='item'></div>
<div class='item'></div>
</div>
<ul id='carousel-custom-dots' class='owl-dots'>
<li class='owl-dot'><!-- Anything in here --></li>
<li class='owl-dot'></li>
<li class='owl-dot'></li>
</ul></code>
</pre>
<p>Next include this inside of your options object.</p>
<pre data-language="javascript"><code data-language="javascript">owl.owlCarousel({
dotsContainer: '#carousel-custom-dots'
});
</code></pre>
<p>The following tells Owl Carousel 2 to go to a slide based on the index of the dot that was clicked.</p>
<pre data-language="javascript"><code data-language="javascript">$('.owl-dot').click(function () {
owl.trigger('to.owl.carousel', [$(this).index(), 300]);
});
</code></pre>
<p>That should be all you need to get custom dots up and going with Owl Carousel 2.</p>
</div>
</article>
</main>
</div><!-- .wrapper -->
<div class='wrapper'>
<footer>
<div class='email'>
<a class='link' href="/contact">derick.r.ruiz@gmail.com</a>
</div>
<!-- Figure out how to loop through the social_services thing in _confing.yml -->
<ul class='social-links'>
<li>
<a href="http://codepen.io/derickruiz"><i class='icon-codepen'></i> <span class='link service'>Codepen</span></a>
</li>
<li>
<a href="https://github.com/derickruiz"><i class='icon-github'></i> <span class='link service'>Github</span></a>
</li>
<li>
<a href="https://twitter.com/drrrruiz"><i class='icon-twitter'></i> <span class='link service'>Twitter</span></a>
</li>
<li>
<a href="https://www.linkedin.com/in/derickruiz"><i class='icon-linkedin'></i> <span class='link service'>Linkedin</span></a>
</li>
</ul>
</footer>
</div>
<script src="/js/vendor/SmartUnderline/js/smart-underline.js"></script>
<script src="/js/vendor/Hyphenator/Hyphenator_Loader.js"></script>
<script src="/js/typography.js"></script>
<script src="/js/vendor/rainbow.js"></script>
<script src="/js/vendor/language/generic.js"></script>
<script>
(function () {
Rainbow.color();
}());
</script>
</body>
</html>