mirror of
https://github.com/WhitestormJS/whs.js.git
synced 2026-01-18 16:03:24 +00:00
24 lines
1006 B
HTML
24 lines
1006 B
HTML
<html><head><title>Example</title><style type="text/css">html, body {
|
|
position: relative;
|
|
height: 100%;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: hidden;
|
|
}</style></head><body><div id="embed" style="position: relative; left: 50px; top: 100px; width: 600px; height: 300px"><div id="sizer" style="position: absolute; right: -20px; height: inherit; width: 20px; background: #ccc"></div></div><script src="../../../build/whitestorm.js"></script><script src="../../../vendor/physics-module.js"></script><script type="text/javascript">const sizer = document.getElementById('sizer');
|
|
const embed = document.getElementById('embed');
|
|
let resize = false;
|
|
|
|
sizer.addEventListener('mousedown', function() {
|
|
resize = true;
|
|
});
|
|
|
|
window.addEventListener('mouseup', function() {
|
|
resize = false;
|
|
});
|
|
|
|
window.addEventListener('mousemove', function(e) {
|
|
if (resize) embed.style.width = (+embed.style.width.replace('px', '') + e.movementX) + 'px';
|
|
});</script><script src="./script.js"></script></body></html> |