Last active
March 2, 2018 20:11
-
-
Save onebytegone/941cb2a3128b474a63908b86b522dff6 to your computer and use it in GitHub Desktop.
Demo of conflict between jQuery and webcomponent.js in Chromecast framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Demo of conflict between jQuery and webcomponent.js in Chromecast framework</title> | |
<script type="text/javascript" src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"></script> | |
<script src="https://unpkg.com/[email protected]/dist/jquery.js"></script> | |
<style> | |
.boxWrapper { | |
position: relative; | |
height: 40px; | |
width: 20px; | |
border: 1px solid black; | |
} | |
#box { | |
position: absolute; | |
top: 20px; | |
width: 20px; | |
height: 20px; | |
background-color: skyblue; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Demo of conflict between jQuery and <code>webcomponents.js</code></h1> | |
<h2>Moving box</h2> | |
<p>This box will move on iOS Safari, but not on Chrome.</p> | |
<div class="boxWrapper"> | |
<div id="box"></div> | |
</div> | |
<h2>Video</h2> | |
<video controls src="http://www.caminandes.com/download/03_caminandes_llamigos_1080p.mp4" type="video/mp4" style="width: 100%;"></video> | |
<script> | |
$(document).ready(function() { | |
setTimeout(function() { | |
var el = $('#box'), | |
moveEl, moveUp, moveDown; | |
moveEl = function(pos, done) { | |
try { | |
el.animate({ | |
top: pos | |
}, 400, done); | |
} catch(e) { | |
alert(e); | |
} | |
}; | |
moveDown = function() { | |
moveEl(20, moveUp); | |
}; | |
moveUp = function() { | |
moveEl(0, moveDown); | |
}; | |
moveUp(); | |
}, 1000); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Differences between revisions: