-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
98 lines (80 loc) · 3.64 KB
/
index.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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>That Half-Drop Image Grid From The Royal Tenenbaums . JavaScript</title>
<link rel = "stylesheet" type="text/css" href="index.css"/>
<script src = "ThatHalfDropImageGridFromTheRoyalTenenbaums.js"></script>
<script>window.onresize = _halfdrop.update;</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head>
<body>
<h1><a href=".">That Half-Drop Image Grid From<br>The Royal Tenenbaums<br>. JavaScript</a></h1>
<pre class="fig-markup"><figure
<em>data-halfdrop = "wes1.jpg"</em>
></figure></pre>
<figure data-halfdrop="img/wes1.jpg"></figure>
<blockquote> A brand-new JavaScript file for repeating an HTML element's background image in a centered half-drop pattern, like that thing (<a href="img/example1.jpg">1</a>, <a href="img/example2.jpg">2</a>, <a href="img/example3.jpg">3</a>) from that movie. Each pattern is customizable through JSON data attributes, with properties based off CSS naming standards.</blockquote>
<h2>Available On <a href="https://github.com/tvler/ThatHalfDropImageGridFromTheRoyalTenenbaums.js">Github</a>,
Built By <a href="http://tylerdeitz.co/">Tyler</a><br><br>
View More <a href="samples">Samples</a>
</h2>
<h3>3 Ways To Use</h3>
<h4><em>1</em><i>HTML + Inline URL</i></h4>
<pre><figure
<em>data-halfdrop = 'wes1.jpg'</em>
></figure></pre>
<h4><em>2</em><i>HTML + CSS URL</i></h4>
<pre>
figure {
<em>background: url('wes1.jpg')</em>
}
<figure
<em>data-halfdrop</em>
></figure></pre>
<h4><em>3</em><i>HTML + JSON</i></h4>
<pre><figure
<em>data-halfdrop = '{</em>
<i>"src"</i> : "wes1.jpg",
<i>"width"</i> : "20%",
<i>"maxWidth"</i> : 200
<em>}'</em>
></figure></pre>
<h5>Default values</h5>
<pre>
<i>"src"</i> : "",</pre>
<p><code>String of the image's URL<br>
(If not given, CSS URL will be used)</code></p><pre>
<i>"snap"</i> : false,</pre>
<p><code>Changes width of image
to create a whole number
of columns, only respecting
one min/max property</code></p><pre>
<i>"minWidth"</i> : 0,
<i>"maxWidth"</i> : "100%",
<i>"width"</i> : 0,
<i>"minHeight"</i> : 0,
<i>"maxHeight"</i> : "100%",
<i>"height"</i> : 0</pre>
<p><code>Can be a number or string
ending in 'px' or '%'</code></p>
<h3>2 Steps To Run</h3>
<h4><em>1</em><i>Link The Javascript File</i></h4>
<pre><script <em>src="ThatHalfDropImageGridFromTheRoyalTenenbaums.js"</em>></script></pre>
<h5>This creates the object<em><code style="padding-left: .8em; font-size: .8em;"><i>_halfdrop</i></code></em></h5>
<h4><em>2</em><i>Set An Event To Update The Background</i></h4>
<pre><em>_halfdrop.update()</em></pre>
<p><code>When a data-halfdrop element resizes, it's background needs to update</code></p>
<h5>Example hook</h5>
<pre>window.onresize =
<em>_halfdrop.update;</em></pre>
<h3>Settings</h3>
<h4><em>1</em><i>Add Or Remove data-halfdrop Elements</i></h4>
<pre><em>_halfdrop.init()</em></pre>
<p><code>Run this function after an element is added or removed</code></p>
<h4><em>2</em><i>Change Dafault Values</i></h4>
<pre><em>_halfdrop.defaultValues</em></pre>
<p><code>The exposed object's properties can be modified, which may reduce overall markup in some situations</code></p>
<p><code>If it's modified after DOMContentLoaded, run _halfdrop.init()</code></p>
</body>
</html>