-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlivedemo.html
137 lines (127 loc) · 3.94 KB
/
livedemo.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
<html>
<head>
<link rel="stylesheet" href="css/jSlabify.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="js/jquery.jSlabify.js"></script>
<script type="text/javascript">
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
$(window).bind("load", function() {
$("#header").jSlabify({
constrainHeight: true,
slabRatio : 3,
hCenter : true
});
$("#slabsource, #slabratio").bind("input propertychange", function (evt) {
// If it's the propertychange event, make sure it's the value that changed.
if (window.event && event.type == "propertychange" && event.propertyName != "value")
return;
slab_it_now();
});
$("#slabforcedim").change( function(){
slab_it_now()
});
});
function slab_it_now() {
var val = $('#slabsource').val();
var ratio = $('#slabratio' ).val();
if(isNumber(ratio) && ratio > 0){
if ($('#slabforcedim').is(':checked')) {
$('#slabwrap .slabme').html(val);
$("#slabwrap .slabme").jSlabify({
constrainHeight: true,
slabRatio : ratio,
hCenter : true,
vCenter : true
});
} else {
$('#slabwrap .slabme').html(val);
$("#slabwrap .slabme").jSlabify({
constrainHeight: true,
slabRatio : ratio,
hCenter : true
});
}
$("#error").text("");
} else {
$("#error").text("*slab ratio must be a number greater than 0");
}
}
</script>
<style>
@font-face {
font-family: 'LeagueGothicRegular';
src: url('font/League_Gothic-webfont.eot');
src: url('font/League_Gothic-webfont.eot?#iefix') format('embedded-opentype'),
url('font/League_Gothic-webfont.woff') format('woff'),
url('font/League_Gothic-webfont.ttf') format('truetype'),
url('font/League_Gothic-webfont.svg#LeagueGothicRegular') format('svg');
font-weight: normal;
font-style: normal;
}
html {
overflow : -moz-scrollbars-vertical;
overflow-y: scroll;
}
#headerwrap {
width: 400px;
padding: 20px;
font-family: 'LeagueGothicRegular', Charcoal, Arial Black, Gadget, Sans serif;
font-weight: normal;
line-height: .9;
text-transform: uppercase;
}
#slabwrap {
width: 400px;
padding: 20px;
border: 1px solid #000;
font-family: 'LeagueGothicRegular', Charcoal, Arial Black, Gadget, Sans serif;
font-weight: normal;
line-height: .9;
text-transform: uppercase;
}
.amp {
font-family:Baskerville,'Goudy Old Style',Palatino,'Book Antiqua',serif;
font-style:italic;
font-weight:lighter;
}
#error {
color: red;
}
</style>
</head>
<body>
<center>
<div id="headerwrap"><div id="header">jSlabify Live Demo</div></h1></div>
<table>
<tr>
<td>
Enter Sample text to Slab:
</td><td>
<input type="text" id="slabsource"/>
</td>
</tr><tr>
<td>
Enter Target Ratio <i>(w/h)</i>:
</td><td>
<input tyoe="text" id="slabratio" value="1"/>
</td>
</tr><tr>
<td>
Force Dimensions?:
</td><td>
<input type="checkbox" id="slabforcedim">
</td>
</tr><tr>
<span id="error"></span>
</tr>
</table>
<br/><br/><hr/><br/>
<div id="slabwrap">
<div class="slabme">
</div>
</div>
</center>
</body>
</html>