-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle2.htm
More file actions
359 lines (347 loc) · 13.5 KB
/
style2.htm
File metadata and controls
359 lines (347 loc) · 13.5 KB
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style type="text/css">
/* Add custom CSS here */
#dataHolder {
width: 960px;
margin: auto;
}
#adTable {
border-collapse: separate;
border-spacing:0 10px;
width: 960px;
margin-top:10px;
}
.header {
margin-top:10px;
font-family: Roboto, sans-serif;
font-weight: 500;
letter-spacing:.10em;
text-align:center;
color:cornflowerblue;
text-transform:uppercase;
font-size:10pt;
user-select:none;
-ms-user-select:none;
-webkit-user-select:none;
-moz-user-select: -moz-none;
}
/*.ad class is used on <tr>*/
.ad {
border: solid 1px #e2e2e2;
border-radius:15px;
}
.section {
padding-top:10px;
padding-bottom:10px;
padding-left:20px;
padding-right:20px;
}
.buttonDiv {
border: solid 2px #fff;
border-radius:45px;
background-color:#FFCF9E !important;
color:white;
text-align: center;
font-size:32pt;
font-family:Roboto, sans-serif;
font-weight:500;
text-transform:uppercase;
width:100px;
margin:auto;
margin-right:10px;
margin-left:10px;
height:40px;
user-select: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
background: #65a9d7;
background: -webkit-gradient(linear, left top, left bottom, from(#FF7F24), to(#FF7F24));
background: -moz-linear-gradient(top, #FF7F24, #FF7F24);
padding: 5px 10px;
position:relative;
box-shadow: -3px 3px 0px 1px white;
-webkit-appearance:none;
-webkit-box-shadow: -3px 3px 0px 1px white;
overflow:hidden;
}
.buttonDiv:hover{font-size:17pt;text-decoration: underline;}
.buttonDiv:before{
content: "";
width: 100%;
height: 100%;
position: absolute;
top: 0%;
left: 0%;
opacity:50%;
overflow:hidden;
background-image: -webkit-linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0.0), rgba(255,255,255,0.3));
background-image: -moz-linear-gradient(135deg, rgba(255,255,255,0), rgba(255,255,255,0.6), rgba(255,255,255,0));
transition: height 2s ease-out;
-moz-transition: height 0.5s ease-out;
-o-transition: height 0.5s ease-out;
-webkit-transition: height 0.5s ease-out;
-ms-transition: height 0.5s ease-out;
border-radius:45px;
}
.buttonDiv:hover:before {
opacity:0%;
height:0%;
border-radius:45px;
}
.title {
font-family:Roboto, sans-serif;
font-weight:500;
font-size:12pt;
background-color:#fff;
color:orange;
padding:25px;
text-align:center;
position:relative;
}
.title:after{
content:'';
width:0px;
height:100%;
border-top:10px solid transparent;
border-left:5px solid #99baf5;
border-bottom:10px solid transparent;
border-right:10px solid transparent;
position:absolute;
right:0px;
top:0%;
overflow:hidden;
transform: scaleX(-1);
margin-top:0px;
}
.title:before{
content:'';
width:0px;
height:0px;
border-top:10px solid transparent;
border-left:10px solid #fff;
border-bottom:10px solid transparent;
border-right:10px solid transparent;
position:absolute;
left:0%;
top:50%;
margin-top:-10px;
}
.body {
font-size:10pt;
font-family:Roboto, sans-serif;
color:gray;
}
.bodySection{
padding-right:20px;
}
.seeMore {
margin: auto;
width:75px;
user-select:none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
font-family: Roboto, sans-serif;
font-weight:500;
color:white;
padding:2px;
background-color:orange;
text-transform:uppercase;
font-size:10pt;
border:2px solid transparent;
}
.seeMore:hover {
background-color:white;
color:orange;
border: 2px solid orange;
}
.lightOrange {
background-color: #FFCF9E;
background-color:orange;
background-color:cornflowerblue;
color:#FFF;
}
td {
border-top: 1px solid cornflowerblue;
border-bottom: 2px solid cornflowerblue;
margin-bottom:5px;
user-select:none;
overflow:hidden;
}
td:first-child {border-left:3px solid cornflowerblue;}
td:last-child {border-right:3px solid cornflowerblue;}
/*Row Hover Styles*/
.tdHover {
border-top: 1px solid orange !important;
border-bottom: 1px solid orange !important;
margin-bottom:5px;
}
.tdHover:first-child {border-left:1px solid orange !important;}
.tdHover:last-child {border-right:1px solid orange !important;}
tbody tr td:first-child {
border-radius: 15px 0 0 15px;
}
tbody tr td:last-child {
width:15px;
border-radius: 0 15px 15px 0;
}
.boxShadow {
box-shadow: -2px 3px 0px 1px #99baf5;
-webkit-appearance:none;
-webkit-box-shadow: -2px 3px 0px 1px #99baf5;
}
</style>
</head>
<body>
<div id="dataHolder">
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
const config = {};
config.userAgent = window.navigator.userAgent.toString();
//regExpressions to find browser type
config.explorerReg = new RegExp(/^.*edge.*$/i);
if (config.explorerReg.test(config.userAgent) == true) {config.browser = 'edge';}
//edit the css definition for browser compatibility
if (config.browser == 'edge') {
console.log (document.styleSheets[0]);
}
var tableItems = [
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_geico.png","title":"Lorem Ipsum dolor sit amet", "body":"<ul><li>Sed id sodales erat</li><li>Quisque eget imperdiet mi, quis pharetra.</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_progressive.png","title":"Quisque varius quam leo", "body":"<ul><li>Morbi palcet fringilla leom</li><li>Vulputate valet sem finibus tortor</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_geico.png","title":"Donec rhoncus, erat at dapibus", "body":"<ul><li>Lectus felis in Vestibulum</li><li>Nallam egestas quis odio</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_progressive.png","title":"In libero erat, laoreet in egestas quis, lacinia at elda odio.", "body":"<ul><li>Proin pellentesque felis at mi rutrum vehicula.</li><li>Etiam volutpat leo in est rhoncus, quis varius urna dignissim</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_geico.png","title" : "Praesent et euismod tortor", "body" : "<ul><li>Duis porta, enim ut pellentesque sollicitudin, est turpis placerat augue</li><li>Integer pretium metus ut nisl</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_progressive.png","title":"Etiam id urna nec metus", "body":"<ul><li>Nulla facilisi, cursus nec</li><li>Vestibulum orci dui</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_geico.png","title" : "Praesent et euismod tortor", "body" : "<ul><li>Pellentesque elementum nunc</li><li>Ut ut mollis massa, vel maximus</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_progressive.png","title":"Aenean dolor ante, scelerisque sit", "body":"<ul><li>Etiam volutpat leo in est rhoncus</li><li>quis varius urna</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_geico.png","title" : "Sed a rhoncus orci. Maecenas euismod nisl", "body" : "<ul><li> Proin pellentesque felis</li><li>Pellentesque egestas gravida</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"},
{"logo":"https://jhaubrich.com/misc/Activity/assets/logo_progressive.png","title":"Aenean dolor ante, scelerisque", "body":"<ul><li>lobortis luctus nibh</li><li>Pellentesque habitant morbi</li></ul>", "CTAText":"Go", "CTAText2":"Go Now"}
],
_tableItemsArray = Object.values(tableItems),
_toggleAds = false;
$( document ).ready(function() { //insert your custom javascript code here
//function to dynamically load Google web fonts
function addGoogleFont(fontname) {
$('head').append("<link href='https://fonts.googleapis.com/css?family=" + fontname + "' rel='stylesheet' type='text/css'>");
}
//I'm going to use the Sans Roboto for the header and titles, Spectral for all other type
addGoogleFont('Roboto:400,500,900|Spectral');
//create the header
var header = document.createElement('div');
$(header).addClass('header');
header.style.textAlign = 'center';
header.innerHTML = 'This is my test Page!';
//header.style.textTransform = 'uppercase';
$('#dataHolder').prepend(header);
//create the table and place it after the header
var table = document.createElement('table');
table.id = "adTable";
$('#dataHolder').append(table);
generateTable();
//append the see more button to toggle the ads
let seeMore = document.createElement('div');
seeMore.innerHTML = '<div id="seeMoreButton" class="seeMore">See More</div>';
seeMore.id = 'seeMore';
//ad an onclick that checks the toggle value. If toggle is false, show all ten ads. If true, show all 10
$(seeMore).click(function () {
//reset the table
_toggleAds = !_toggleAds;
if (_toggleAds == true) {
document.getElementById('seeMoreButton').innerHTML = 'See Less';
} else {
document.getElementById('seeMoreButton').innerHTML = 'See More';
}
$(table).html('');
console.log($(table));
generateTable();
});
seeMore.style.textAlign = 'center';
$('#adTable').after(seeMore);
//generateTable fills the <table> with contents
function generateTable() {
//loop through the tableItems and place each ad as its own <tr> in the table
$.each(tableItems, function ( adIndex, value ) {
//insert the current ad in the loop into the table. Only show the first 4 first
if (adIndex == 4 && _toggleAds == false) {console.log('break here');return false;}
let thisAd = document.createElement('tr');
thisAd.id = adIndex + "_ad";
$(thisAd).addClass('ad');
$(table).append(thisAd);
//insert contents of each ad section
$.each(value, function (section, value) {
let thisSection = document.createElement('td');
thisSection.id = thisAd.id + "_" + section;
//if section is logo insert the image
console.log(section);
if (section == 'logo') {
thisSection.innerHTML = "<img src='" + value + "' alt='logo'>";
$(thisSection).addClass('section');
}
//if section is CTATEXT place the button div
else if (section == 'CTAText') {
let buttonDiv = document.createElement('div');
buttonDiv.innerHTML = '<div style="position:relative;top:50%;transform: translateY(-50%);">' + value + "</div>";
$(thisSection).addClass('lightOrange');
$(buttonDiv).mouseover(function() {
buttonDiv.innerHTML = '<div style="position:relative;top:50%;transform: translateY(-50%);">' + _tableItemsArray[adIndex].CTAText2 + '</div>' ;
//$(buttonDiv).addClass('CTAText2').removeClass('buttonDiv');
});
$(buttonDiv).mouseleave(function() {
buttonDiv.innerHTML = '<div style="position:relative;top:50%;transform: translateY(-50%);">' + _tableItemsArray[adIndex].CTAText + '</div>';
//$(buttonDiv).addClass('buttonDiv').removeClass('CTAText2');
});
$(thisAd).mouseleave(function() {
buttonDiv.innerHTML = '<div style="position:relative;top:50%;transform: translateY(-50%);">' + _tableItemsArray[adIndex].CTAText + '</div>';
//$(buttonDiv).addClass('buttonDiv').removeClass('CTAText2');
});
$(buttonDiv).addClass('buttonDiv');
$(thisSection).append(buttonDiv);
}
else if (section == 'CTAText2') {
$(thisSection).addClass('CTAText2hide').addClass('lightOrange');
}
else {
thisSection.innerHTML = value;
$(thisSection).addClass(section);
if (section == 'body') {
$(thisSection).addClass('bodySection lightOrange');
}
}
$(thisAd).append(thisSection);
});//end of section loop
//add an onclick to the item row that changes the border color
$(thisAd).mouseover(function() {
if (config.browser != 'edge') {
$(thisAd).addClass('boxShadow');
} else {//IE needs to just change the <td> class instead of adding a boxshadow
//only add the tdHover if the window width is larger than 475
if (window.innerWidth > 475) {
$(thisAd).children().addClass('tdHover');
console.log(thisAd + ":first-child");
}
}
});
$(thisAd).mouseleave(function() {
if (config.browser != 'edge') {
$(thisAd).removeClass('boxShadow');
} else {
$(thisAd).children().removeClass('tdHover');
}
});
});//end of tableItems loop
}//end of generateTable();
});
</script>
</html>