Skip to content

Commit cd2f81e

Browse files
committed
CTA displays correctly on mobile
1 parent faa972d commit cd2f81e

File tree

4 files changed

+64
-32
lines changed

4 files changed

+64
-32
lines changed

css/main.css

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ h1, h2 {
4949
}
5050

5151
#main {
52-
overflow:hidden;
52+
overflow:none;
5353
position: absolute;
5454
top: 50%;
5555
left: 50%;
@@ -307,7 +307,9 @@ h1, h2 {
307307
#cta {
308308
width: 100%;
309309
height:100%;
310-
top: 0;
310+
z-index:2000;
311+
top:0;
312+
position:absolute;
311313
left: 0;
312314
margin-left: 0;
313315
margin-top: 0;
@@ -324,15 +326,14 @@ h1, h2 {
324326

325327
.panelContainer{
326328
width:50%;
327-
top:50%;
328-
transform:translateY(-50%);
329-
left:2vw;
329+
top:200px;
330+
left:50px;
330331
position:absolute
331332
}
332333
.panelHeader {
333334
color: #9F0C37;
334335
padding: 16px;
335-
font-size:1.6em;
336+
font-size:2em;
336337
}
337338
.panelBody {
338339
padding: 32px 16px;
@@ -341,6 +342,7 @@ h1, h2 {
341342
.panelBody .btn {
342343
width: 150px;
343344
height:150px;
345+
cursor: pointer;
344346
border-radius: 30px;
345347
border:2px solid #9F0C37;
346348
background-color: rgba(255,255,255,0.5);
@@ -366,14 +368,14 @@ h1, h2 {
366368
}
367369

368370
#donateBox{
369-
position:fixed;
370-
right:0px;
371-
bottom:150px;
371+
position:absolute;
372+
padding: 16px;
373+
top:200px;
372374
width:50%;
373375
max-width: 700px;
374376
min-width: 250px;
375377
color:#9F0C37;
376-
padding-right: 50px;
378+
right:50px;
377379
font-size:2em;
378380
}
379381

@@ -563,5 +565,7 @@ h1, h2 {
563565
left: -50px;
564566
right: -50px;
565567
z-index: 500;
568+
}
569+
#pauseButton{
566570
cursor: pointer;
567571
}

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ <h1>
9292
<img src="assets/cta-background.png" />
9393
<div class="panelContainer">
9494
<div class="panelHeader">
95-
<h2>Thanks for Watching</h2>
96-
<h3>Use the links below to find out more about p5.js.</h3>
95+
<h1>Thanks for Watching</h1>
96+
<p>Use the links below to find out more about p5.js.</p>
9797
</div>
9898

9999
<div class="panelBody">

js/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ var main = {
5959
});
6060

6161
$("#progressBar").click(function (e) {
62+
// This has been disabled
6263
//console.log(script.popcorn.currentTime());
6364
let clickX = e.pageX;
6465
let width = $(window).width();

js/script.js

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ var script = {
2626
var position = pop.currentTime() / pop.duration();
2727
var width = position * $("#main").width();
2828
$("#progress").css('width', width);
29+
if (position > 1 && position > 0.988){
30+
$("#pause").css({ 'display': 'none' });
31+
$("#progressBar").css({ 'display': 'none' });
32+
$("#videoClip").css({ 'display': 'none' });
33+
$("#videoCanvas").css({ 'display': 'none' });
34+
$("#cta").css({ 'display': 'block' });
35+
$("#cta").animate({ 'opacity': 1 }, { duration: 500 });
36+
37+
//$("#cta").css({ 'display': 'block' });
38+
//$("#cta").animate({ 'opacity': 1 }, { duration: 500 });
39+
}
2940
});
3041

3142
/* Prevent picture-in-picture which breaks playthrough on mobile */
@@ -40,7 +51,6 @@ var script = {
4051
/* Script */
4152

4253
// Q intro
43-
4454
pop.code({
4555
start: 1,
4656
end: 3.9,
@@ -158,7 +168,9 @@ var script = {
158168
start: 38.5,
159169
end: 42,
160170
onStart: function (options) {
161-
main.sketch.hideExamples();
171+
try{
172+
main.sketch.hideExamples();
173+
} catch { }
162174
}
163175
});
164176

@@ -167,7 +179,10 @@ var script = {
167179
start: 43,
168180
end: 45.1,
169181
onStart: function (options) {
170-
main.sketch.remove();
182+
try {
183+
main.sketch.hideInstruction();
184+
main.sketch.remove();
185+
} catch { }
171186
}
172187
});
173188

@@ -242,8 +257,10 @@ var script = {
242257
start: 82.5,
243258
end: 89,
244259
onStart: function (options) {
245-
main.sketch.hideInstruction();
246-
main.sketch.remove();
260+
try {
261+
main.sketch.hideInstruction();
262+
main.sketch.remove();
263+
} catch { }
247264
}
248265
})
249266

@@ -292,8 +309,10 @@ var script = {
292309
start: 108.5,
293310
end: 113,
294311
onStart: function (options) {
295-
main.sketch.stopFlocking();
296-
main.sketch.remove();
312+
try {
313+
main.sketch.stopFlocking();
314+
main.sketch.remove();
315+
} catch { }
297316
$("#sketchCanvas").stop();
298317
$("#sketchCanvas").css({ opacity: 1 });
299318
$("#sketchCanvas").show();
@@ -435,10 +454,12 @@ var script = {
435454
start: 128,
436455
end: 130,
437456
onStart: function (options) {
438-
main.sketch.hideInstruction();
439-
main.sketch.disableMouse();
440-
main.sketch.stopDrawing();
441-
main.sketch.remove();
457+
try {
458+
main.sketch.hideInstruction();
459+
main.sketch.disableMouse();
460+
main.sketch.stopDrawing();
461+
main.sketch.remove();
462+
} catch { }
442463
$("#sketchCanvas").stop();
443464
$("#sketchCanvas").css({ opacity: 1 });
444465
$("#sketchCanvas").show();
@@ -453,7 +474,6 @@ var script = {
453474
end: 140,
454475
onStart: function (options) {
455476
main.sketch = new p5(webglSketch, "sketchCanvas");
456-
457477
var position = main.getRelativePosition({ left: -830, top: 940 });
458478
var panel = main.sketch.showInstruction("(scroll + drag mouse)", position.left, position.top);
459479
panel.parent('sketchOverlay');
@@ -464,8 +484,10 @@ var script = {
464484
start: 147.5,
465485
end: 149,
466486
onStart: function (options) {
467-
main.sketch.hideInstruction();
468-
main.sketch.remove();
487+
if (main.sketch) {
488+
main.sketch.hideInstruction();
489+
main.sketch.remove();
490+
}
469491
}
470492
})
471493

@@ -489,20 +511,25 @@ var script = {
489511
start: 159,
490512
end: 180,
491513
onStart: function (options) {
492-
main.sketch.hideInstruction();
493-
main.sketch.remove();
514+
try {
515+
main.sketch.hideInstruction();
516+
main.sketch.remove();
517+
} catch { }
494518
}
495519
})
496520

497521

498522
// CTA
499523
pop.code({
500-
start: 240.2,
524+
start: 238,
501525
end: 250,
502526
onStart: function (options) {
503-
$("#pause").hide();
504-
$("#progressBar").hide();
505-
$("#cta").show().animate({ opacity: '1' }, { duration: 500 });
527+
$("#cta").css({ 'display': 'block' });
528+
$("#cta").animate({ 'opacity': 1 }, { 'duration': 500 });
529+
$("#pause").css({ 'display': 'none' });
530+
$("#progressBar").css({ 'display': 'none' });
531+
$("#videoClip").css({ 'display': 'none' });
532+
$("#videoCanvas").css({ 'display': 'none' });
506533
}
507534
});
508535

0 commit comments

Comments
 (0)