alloytouch
Version:
super tiny size touch and physical motion library for the web
347 lines (281 loc) • 12 kB
HTML
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title>AlloyTouch</title>
<style type="text/css">
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
-ms-touch-action: none;
}
body, ul, li {
padding: 0;
margin: 0;
border: 0;
}
body {
font-size: 12px;
font-family: ubuntu, helvetica, arial;
}
.header {
position: absolute;
z-index: 2;
top: 0;
left: 0;
width: 100%;
height: 85px;
line-height: 42px;
background: #00ABEB;
padding: 0;
color: #eee;
font-size: 20px;
text-align: left;
font-weight: bold;
text-indent: 20px;
}
.dir {
font-weight: normal;
font-size: 15px;
line-height: 18px;
text-indent: 0px;
margin-left: 20px;
margin-right: 20px;
}
</style>
<style>
.border-1px {
position: relative;
}
.border-1px:after {
display: block;
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
-webkit-transform-origin: 0 0;
-webkit-transform: scale(1);
pointer-events: none;
}
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
.border-1px:after {
right: -100%;
bottom: -100%;
-webkit-transform: scale(0.5);
}
}
.border-1px.border-bottom:after {
border-bottom: 1px solid #e4e4e4;
}
.border-1px.border-top:after {
border-top: 1px solid #e4e4e4;
}
.border-1px.border-left:after {
border-left: 1px solid #e4e4e4;
}
.border-1px.border-right:after {
border-right: 1px solid #e4e4e4;
}
.ms {
background-color: #ffffff;
margin-top: 86px;
}
.title {
height: 66px;
position: relative;
cursor: pointer;
}
.arrow {
margin-left: 10px;
position: relative;
top: 1px;
width: 8px;
}
.level_detail {
position: absolute;
top: 20px;
right: 20px;
font-size: 14px;
color: #333333;
line-height: 28px;
}
.line_top {
font-size: 18px;
color: #000000;
line-height: 76px;
text-align: left;
}
.line_bt {
font-size: 14px;
color: #333333;
text-align: left;
}
.left_pn {
text-indent: 12px;
}
.item {
position: relative;
height: 66px;
/*display: none;*/
}
.item1 {
position: absolute;
width: 30px;
left: 29px;
top: 15px;
}
.item2 {
margin-left: 94px;
position: relative;
height: 66px;
}
.item3 {
position: absolute;
right: 12px;
top: 29px;
}
.line_one {
font-size: 18px;
color: #333333;
text-align: left;
line-height: 18px;
line-height: 66px;
}
.blue_score {
color: #12b7f5;
}
.demo.arrow {
position: absolute;
top: 30px;
right: 22px;
}
.btn {
background: #00ABEB;
border: 1px solid #c3c8cc;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
height: 35px;
font-size: 15px;
color: white;
text-align: center;
line-height: 35px;
margin: 20px 40px 40px 20px;
cursor:pointer;
}
.goToMobile{
text-align:center;
display:none;
margin-top:100px;
}
.note{
text-align:center;
margin-top:20px;
font-size:20px;
display:none;
}
</style>
</head>
<body>
<div class="header">
<div>AlloyTouch</div>
<div class="dir">Smooth scrolling, rotation, pull to refresh, page transition and any motion for the web.</div>
</div>
<div class="goToMobile" id="goToMobile">
<img src="../example/asset/alloytouch.png" alt="" />
</div>
<div class="ms" id="ms">
<div class="title border-1px border-bottom" onclick="goToUrl('https://github.com/AlloyTeam/AlloyTouch')">
<div class="left_pn">
<div class="line_top">
<iframe src="//ghbtns.com/github-btn.html?user=alloyteam&repo=alloytouch&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
</div>
</div>
<div class="level_detail">Fork me on GitHub<img class="arrow" src="../example/asset/arrow.png" alt="" /></div>
</div>
<div class="item" onclick="goToUrl('http://alloyteam.github.io/AlloyTouch/full_page/')">
<img class="item1" src="../example/asset/full_page.png" style="margin-top: 2px;" alt="" />
<div class="item2 border-1px border-bottom">
<div class="line_one">Full Page</div>
</div>
<img class="arrow demo" src="../example/asset/arrow.png" alt="" />
</div>
<!--<div class="item" onclick="goToUrl('../example/button.html')">-->
<!--<img class="item1" src="../example/asset/tap.png" style="width: 25px;" alt="" />-->
<!--<div class="item2 border-1px border-bottom">-->
<!--<div class="line_one">Tap Demo </div>-->
<!--</div>-->
<!--<img class="arrow demo" src="../example/asset/arrow.png" alt="" />-->
<!--</div>-->
<div class="item" onclick="goToUrl('../example/drag.html')">
<img class="item1" src="../example/asset/drag.png" style="width: 25px;" alt="" />
<div class="item2 border-1px border-bottom">
<div class="line_one">Drag Demo </div>
</div>
<img class="arrow demo" src="../example/asset/arrow.png" alt="" />
</div>
<div class="item" onclick="goToUrl('../example/simple.html')">
<img class="item1" src="../example/asset/scroll.png" alt="" />
<div class="item2 border-1px border-bottom">
<div class="line_one">Scrolling Demo </div>
</div>
<img class="arrow demo" src="../example/asset/arrow.png" alt="" />
</div>
<div class="item" onclick="goToUrl('../example/rotate.html')">
<img class="item1" src="../example/asset/rotation2d.png" alt="" />
<div class="item2 border-1px border-bottom">
<div class="line_one">Rotation 2D</div>
</div>
<img class="arrow demo" src="../example/asset/arrow.png" alt="" />
</div>
<div class="item" onclick="goToUrl('../example/3d.html')">
<img class="item1" src="../example/asset/rotation.png" alt="" />
<div class="item2 border-1px border-bottom">
<div class="line_one">Rotation 3D</div>
</div>
<img class="arrow demo" src="../example/asset/arrow.png" alt="" />
</div>
<div class="item" onclick="goToUrl('../example/carousel.html')">
<img class="item1" src="../example/asset/carousel.png" style="margin-top: 2px;" alt="" />
<div class="item2 border-1px border-bottom">
<div class="line_one">Carousel</div>
</div>
<img class="arrow demo" src="../example/asset/arrow.png" alt="" />
</div>
<div class="item" onclick="goToUrl('../example/threejs/')">
<img class="item1" src="../example/asset/webgl.png" style="margin-top: 2px;" alt="" />
<div class="item2 border-1px border-bottom">
<div class="line_one">WebGL</div>
</div>
<img class="arrow demo" src="../example/asset/arrow.png" alt="" />
</div>
</div>
<div class="note" id="note">Please use mobile device to access the site.</div>
<a href="https://github.com/AlloyTeam/AlloyTouch" target="_blank" id="githubLink" style="position: fixed;display:none; right: 0; top: 0; z-index: 3;width:140px;height:140px;">
<img src="//alloyteam.github.io/github.png" style="width:140px;" alt="">
</a>
<div class="btn" onclick="goToUrl('https://github.com/AlloyTeam/AlloyTouch')">More Demos...</div>
<script>
function goToUrl(url){
location.href = url;
}
var isMobile = false; //initiate as false
// device detection
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4))) isMobile = true;
if (!isMobile) {
document.querySelector("#goToMobile").style.display = "block";
document.querySelector("#ms").style.display = "none";
document.querySelector("#gotoMore").style.display = "none";
document.querySelector("#githubLink").style.display = "block";
document.querySelector("#note").style.display = "block";
}
</script>
</body>
</html>