-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwaitForTwoEvents.html
56 lines (56 loc) · 1.45 KB
/
waitForTwoEvents.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
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
input {display: block; margin-bottom: 20px;}
</style>
</head>
<body>
<input type="button" id="button1" value="Button1" />
<input type="button" id="button2" value="Button2" />
<script>
(function () {
var button1val = false,
button2val = false,
button1 = function () {
console.log('button1 clicked');
button1val = true;
if (button2val) {
bothClicked();
}
},
button2 = function () {
console.log('button2 clicked');
button2val = true;
if (button1val) {
bothClicked();
}
},
bothClicked = function () {
console.log('both clicked');
button1val = false;
button2val = false;
};
document.getElementById('button1').addEventListener('click', button1, false);
document.getElementById('button2').addEventListener('click', button2, false);
})();
</script>
</body>
</html>
document.addEventListener('pageready', function () {
window.setTimeout(function () {
//check if the lead article image has loaded and then initiate the scroll
var $activeCell = $('.cell').filter('.visible'),
initScrollers = false,
$leadImage = $activeCell.find('figure').find('img');
$leadImage.on('load', function () {
initScrollers = true;
NI.section.scrollers.enable();
});
if ($leadImage.height() > 0 && initScrollers === false) {
NI.section.scrollers.enable();
}
}, 0);
}, false);