-
Notifications
You must be signed in to change notification settings - Fork 0
/
minimap.html
285 lines (279 loc) · 21.5 KB
/
minimap.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<!DOCTYPE HTML>
<html lang="en">
<head>
<title> Minimap - A JQuery Plugin | JS | toolitup.com</title>
<meta charset="UTF-8">
<meta name="description" content="A preview of full webpage or its DOM element with flexible positioning and navigation support">
<meta name="robots" content="INDEX, FOLLOW, NOODP, NOARCHIVE" />
<meta name="keywords" content="preview, scroll, minimap, jquery">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=0.25, minimum-scale=0.1, maximum-scale=2.0, user-scalable=1" />
<meta property="og:title" content="Minimap - A JQuery Plugin | JS | toolitup.com" />
<meta property="og:image" content="assets/images/logo.png" />
<meta property="og:description" content="A preview of full webpage or its DOM element with flexible positioning and navigation support" />
<meta property="og:site_name" content="toolitup" />
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css" />
<link rel="canonical" href="http://www.toolitup.com/minimap.html" />
<link rel="shortcut icon" href="favicon.png" type="image/png">
<link rel="icon" href="favicon.png" type="image/png">
<link rel="stylesheet" href="assets/css/toolitup-minimap.css" />
<link rel="stylesheet" href="assets/css/jquery-ui-slider-pips.css" />
<link rel="stylesheet" href="assets/css/minimap.min.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="assets/js/jquery-ui-slider-pips.min.js"></script>
</head>
<body>
<div id="fb-root"> </div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '791808880883628',
xfbml: true,
version: 'v2.1'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = "http://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="mi-container">
<div class="mi-row">
<a href="http://www.toolitup.com" class="t-logo">
<img src="assets/images/logo.png" alt="ToolitUp.com">
</a>
<div class='mi-header'>
<h3 class="mi-prefix">$</h3>
<h3 class="mi-title">Minimap </h3>
<h3 class="mi-connect">|</h3>
<h3 class="mi-title">A JQuery Plugin</h3>
</div>
<div class='t-social' data-like="❤ ❤ ❤">
<a href="https://twitter.com/share" class="twitter-share-button" data-count="vertical" data-url="http://www.toolitup.com/minimap.html" data-text="Minimap - A JQuery Plugin | JS | toolitup.com" data-hashtags="javascript,jQuery,jQuery-toolitup">Tweet</a>
<g:plusone size="tall" data-href="http://www.toolitup.com/minimap.html"></g:plusone>
<script src="http://platform.linkedin.com/in.js" type="text/javascript">
lang: en_US
</script>
<script type="IN/Share" data-url="http://www.toolitup.com/minimap.html" data-counter="top"></script>
<div class="fb-like" data-href="http://www.toolitup.com/minimap.html" data-layout="box_count" data-action="like" data-width="60" data-show-faces="true" data-share="false"></div>
</div>
</div>
<div class="mi-row mi-fork">
<span id="forkongithub"><a href="https://github.com/princejwesley/minimap"><i class="fa fa-github"></i> fork me</a></span>
</div>
<div class="mi-row">
<h4 class="mi-description"><i class="fa fa-quote-left"></i>A preview of full webpage or its DOM element with flexible positioning and navigation support<i class="fa fa-quote-right"></i></h4>
</div>
<div class="mi-demo">
<h3>Download the latest code</h3>
<p><a href="https://github.com/princejwesley/minimap">Fork</a> the repository or download js/css files from <a href="https://github.com/princejwesley/minimap/tree/master/dist">dist</a> directory.</p>
<h3>Including it on your page</h3>
<p>Include jQuery and this plugin on a page.</p>
<pre class="editor-colors lang-html"><div class="line"><span class="text html basic"><span class="meta tag inline any html"><span class="punctuation definition tag begin html"><span><</span></span><span class="entity name tag inline any html"><span>link</span></span><span> </span><span class="entity other attribute-name html"><span>rel</span></span><span>=</span><span class="string quoted double html"><span class="punctuation definition string begin html"><span>"</span></span><span>stylesheet</span><span class="punctuation definition string end html"><span>"</span></span></span><span> </span><span class="entity other attribute-name html"><span>href</span></span><span>=</span><span class="string quoted double html"><span class="punctuation definition string begin html"><span>"</span></span><span>minimap.min.css</span><span class="punctuation definition string end html"><span>"</span></span></span><span class="punctuation definition tag end html"><span> /></span></span></span></span></div><div class="line"><span class="text html basic"><span class="meta tag any html"><span class="punctuation definition tag html"><span><</span></span><span class="entity name tag html"><span>script</span></span><span> </span><span class="entity other attribute-name html"><span>src</span></span><span>=</span><span class="string quoted double html"><span class="punctuation definition string begin html"><span>"</span></span><span>jquery.js</span><span class="punctuation definition string end html"><span>"</span></span></span><span class="punctuation definition tag html"><span>></span><span class="meta scope between-tag-pair html"><span><</span></span><span>/</span></span><span class="entity name tag html"><span>script</span></span><span class="punctuation definition tag html"><span>></span></span></span></span></div><div class="line"><span class="text html basic"><span class="meta tag any html"><span class="punctuation definition tag html"><span><</span></span><span class="entity name tag html"><span>script</span></span><span> </span><span class="entity other attribute-name html"><span>src</span></span><span>=</span><span class="string quoted double html"><span class="punctuation definition string begin html"><span>"</span></span><span>minimap.min.js</span><span class="punctuation definition string end html"><span>"</span></span></span><span class="punctuation definition tag html"><span>></span><span class="meta scope between-tag-pair html"><span><</span></span><span>/</span></span><span class="entity name tag html"><span>script</span></span><span class="punctuation definition tag html"><span>></span></span></span></span></div></pre>
<h3 id="basic-usage">Basic Usage</h3>
<pre class="editor-colors lang-javascript"><div class="line"><span class="source js"><span class="comment line double-slash js"><span class="punctuation definition comment js"><span>//</span></span><span>Desired dom element</span><span> </span></span></span></div><div class="line"><span class="source js"><span class="storage modifier js"><span>var</span></span><span> previewBody </span><span class="keyword operator js"><span>=</span></span><span> $</span><span class="meta brace round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>body</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta brace round js"><span>)</span></span><span class="meta delimiter method period js"><span>.</span></span><span>minimap</span><span class="meta brace round js"><span>(</span><span>)</span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre>
<h3 id="properties">Properties</h3>
<h4 class="slide-property">heightRatio</h4>
<div id="hRslider" class="slider"></div>
<blockquote>
<p><code>height</code> ratio of the view port. ratio can be in the range [0.0, 1.0). (<em>default: <strong>0.6</strong></em>)</p>
</blockquote>
<h4 class="slide-property">widthRatio</h4>
<div id="wRslider" class="slider"></div>
<blockquote>
<p><code>width</code> ratio of the view port. ratio can be in the range [0.0, 0.5). (<em>default: <strong>0.05</strong></em>)</p>
</blockquote>
<h4 class="slide-property">offsetHeightRatio</h4>
<div id="ohRslider" class="slider"></div>
<blockquote>
<p>Margin <code>top</code> ratio of the view port. ratio can be in the range (0.0, 0.9]. (<em>default: <strong>0.035</strong></em>)</p>
</blockquote>
<h4 class="slide-property">offsetWidthRatio</h4>
<div id="owRslider" class="slider"></div>
<blockquote>
<p>Margin <code>left</code> or <code>right</code>(<em>based on <code>position</code> property</em>) ratio of the view port. ratio can be in the range (0.0, 0.9]. (<em>default: <strong>0.035</strong></em>)</p>
</blockquote>
<h4 class="position">position</h4>
<label class="switch">
<input type="checkbox" class="switch-input" id='pos1' checked>
<span class="switch-label" data-on="Left" data-off="Right"></span>
<span class="switch-handle"></span>
</label>
<blockquote>
<p><code>position</code> of the minimap. Supported positions are:</p>
</blockquote>
<ol>
<li><code>'right'</code> (<em>default</em>)</li>
<li><code>'left'</code>
</li>
</ol>
<h3>touch</h3>
<blockquote>
<p><code>touch</code> support. (default: <em>true</em>)</p>
</blockquote>
<h3 class="slide-property">smoothScroll</h3>
<label class="switch">
<input type="checkbox" class="switch-input" id='smoothScroll' checked>
<span class="switch-label" data-on="Off" data-off="On"></span>
<span class="switch-handle"></span>
</label>
<blockquote>
<p>linear <code>animation</code> support for scrolling. (dafault: <em>true</em>)</p>
</blockquote>
<h3 class="slide-property">smoothScrollDelay</h3>
<div id="smoothDelay1" class="slider"></div>
<blockquote>
<p>Smooth scroll delay in milliseconds. (default: 200ms)</p>
</blockquote>
<h2>Setters</h2>
<h3 class="position">function setPosition(position)</h3>
<label class="switch">
<input type="checkbox" class="switch-input" id="pos2" checked>
<span class="switch-label" data-on="Left" data-off="Right"></span>
<span class="switch-handle"></span>
</label>
<blockquote>
<p>Set <code>position</code> property. <code>position</code> can be either <code>'left'</code> or <code>'right'</code>
</p>
</blockquote>
<h3 class="slide-property slide-wide">function setHeightRatio(ratio)</h3>
<div id="hRslider1" class="slider"></div>
<blockquote>
<p>Set <code>heightRatio</code> property.</p>
</blockquote>
<h3 class="slide-property slide-wide">function setWidthRatio(ratio)</h3>
<div id="wRslider1" class="slider"></div>
<blockquote>
<p>Set <code>widthRatio</code> property.</p>
</blockquote>
<h3 class="slide-property slide-wide">function setOffsetHeightRatio(ratio)</h3>
<div id="ohRslider1" class="slider"></div>
<blockquote>
<p>Set <code>offsetHeightRatio</code> property.</p>
</blockquote>
<h3 class="slide-property slide-wide">function setOffsetWidthRatio(ratio)</h3>
<div id="owRslider1" class="slider"></div>
<blockquote>
<p>Set <code>offsetWidthRatio</code> property.</p>
</blockquote>
<h3 class="slide-property">function setSmoothScroll(smooth)</h3>
<label class="switch">
<input type="checkbox" class="switch-input" id='smoothScroll1' checked>
<span class="switch-label" data-on="Off" data-off="On"></span>
<span class="switch-handle"></span>
</label>
<blockquote>
<p>Set <code>smoothScroll</code> property</p>
</blockquote>
<h3 class="slide-property slide-wide">function setSmoothScrollDelay(duration)</h3>
<div id="smoothDelay" class="slider"></div>
<blockquote>
<p>Set <code>setSmoothScrollDelay</code> property.</p>
</blockquote>
<h2 id="callback">Callback</h2>
<h3 id="function-onpreviewchange-">function onPreviewChange()</h3>
<blockquote>
<p><code>onPreviewChange</code> callback will be triggered for the below cases:</p>
</blockquote>
<ol>
<li>View port is resized.</li>
<li>Calling setter functions.</li>
</ol>
<h2>Other functions</h2>
<h3>function show()</h3>
<blockquote>
<p>Show preview</p>
</blockquote>
<h3>function hide()</h3>
<blockquote>
<p>Hide preview</p>
</blockquote>
<h3 class="toggle">function toggle()</h3>
<label class="switch">
<input type="checkbox" class="switch-input" id="toggle" checked>
<span class="switch-label" data-off="Show" data-on="Hide"></span>
<span class="switch-handle"></span>
</label>
<blockquote>
<p>Toggle Preview</p>
</blockquote>
<h3 id="default-settings">Default Settings</h3>
<p>Mini-map with default values</p>
<pre class="editor-colors lang-javascript"><div class="line"><span class="source js"><span class="storage modifier js"><span>var</span></span><span> previewBody </span><span class="keyword operator js"><span>=</span></span><span> $</span><span class="meta brace round js"><span>(</span></span><span class="string quoted single js"><span class="punctuation definition string begin js"><span>'</span></span><span>body</span><span class="punctuation definition string end js"><span>'</span></span></span><span class="meta brace round js"><span>)</span></span><span class="meta delimiter method period js"><span>.</span></span><span>minimap</span><span class="meta brace round js"><span>({</span></span></span></div><div class="line"><span class="source js"><span> heightRatio </span><span class="keyword operator js"><span>:</span></span><span> </span><span class="constant numeric js"><span>0.6</span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span> widthRatio </span><span class="keyword operator js"><span>:</span></span><span> </span><span class="constant numeric js"><span>0.05</span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span> offsetHeightRatio </span><span class="keyword operator js"><span>:</span></span><span> </span><span class="constant numeric js"><span>0.035</span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span> offsetWidthRatio </span><span class="keyword operator js"><span>:</span></span><span> </span><span class="constant numeric js"><span>0.035</span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span> position </span><span class="keyword operator js"><span>:</span></span><span> </span><span class="string quoted double js"><span class="punctuation definition string begin js"><span>"</span></span><span>right</span><span class="punctuation definition string end js"><span>"</span></span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span> touch</span><span class="keyword operator js"><span>:</span></span><span> </span><span class="constant language boolean true js"><span>true</span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span> smoothScroll</span><span class="keyword operator js"><span>:</span></span><span> </span><span class="constant language boolean true js"><span>true</span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span> smoothScrollDelay</span><span class="keyword operator js"><span>:</span></span><span> </span><span class="constant numeric js"><span>200</span></span><span class="meta delimiter object comma js"><span>,</span></span></span></div><div class="line"><span class="source js"><span> </span><span class="meta function json js"><span class="entity name function js"><span>onPreviewChange</span></span><span>: </span><span class="storage type function js"><span>function</span></span><span class="punctuation definition parameters begin js"><span>(</span></span><span class="punctuation definition parameters end js"><span>)</span></span></span><span> </span><span class="punctuation section scope begin js"><span>{</span></span><span class="punctuation section scope end js"><span>}</span></span></span></div><div class="line"><span class="source js"><span class="meta brace curly js"><span>}</span></span><span class="meta brace round js"><span>)</span></span><span class="punctuation terminator statement js"><span>;</span></span></span></div></pre>
<h4 id="css-classes">CSS classes</h4>
<p>Use the below css classes for customization</p>
<blockquote>
<p><code class="css-class">.minimap</code> - Mini-map area</p>
<p><code class="css-class">.miniregion</code> - Mini-map view area</p>
</blockquote>
<h2 id="caveats">Caveats</h2>
<ol>
<li>Browser's <code>find</code> gives result in both the page & its preview</li>
<li>Async updates to the dom elements after minimap was created may not reflect in the preview.</li>
</ol>
<h2 id="license">License</h2>
<p>This plugin is licensed under the <a href="https://github.com/princejwesley/minimap/blob/master/LICENSE">MIT license</a>.</p>
<p>Copyright (c) 2014 <a href="http://www.toolitup.com">Prince John Wesley</a>
</p>
</div>
<div class="mi-row">
<span id="forkongithub"><a href="https://github.com/princejwesley/minimap"><i class="fa fa-github"></i> fork me</a></span>
</div>
<div class="mi-row">
</div>
</div>
<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-55005923-1', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
<script type="text/javascript">
window.___gcfg = {
lang: 'en-US'
};
(function() {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
</script>
<script>
! function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');
</script>
<script src="assets/js/minimap.min.js"></script>
<script src="assets/js/toolitup-minimap.min.js"></script>
</body>
</html>