keitairc (2.0) | 2010-05-19 09:41 |
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { if (document.cookie.indexOf("iphone_redirect=false") == -1) { window.location = "http://m.espn.go.com/wireless/?iphone&;i=COMR"; } }
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
<rel="apple-touch-icon" href="images/template/engage.png"/>
html, body, form, fieldset, p, div, h1, h2, h3, h4, h5, h6 { -webkit-text-size-adjust:none; }
window.onload = function initialLoad() { updateOrientation(); } function updateOrientation(){ var contentType = "show_"; switch(window.orientation){ case 0: contentType += "normal"; break; case -90: contentType += "right"; break; case 90: contentType += "left"; break; case 180: contentType += "flipped"; break; } document.getElementById("page_wrapper").setAttribute("class", contentType); }
@media screen and (max-device-width: 480px){ /* All iPhone only CSS goes here */ }
@media screen and (max-device-width: 480px){ img{ max-width:100%; height:auto; } }
window.addEventListener('load', function() { setTimeout(scrollTo, 0, 0, 1); }, false);
<a href="sms:12345678900">Send me a text</a>
var myLinks = document.getElementsByTagName('a'); for(var i = 0; i < myLinks.length; i++){ myLinks[i].addEventListener('touchstart', function(){this.className = "hover";}, false); myLinks[i].addEventListener('touchend', function(){this.className = "";}, false); }
a:hover, a.hover { /* whatever your hover effect is */ }
* { -webkit-tap-highlight-color: rgba(160,160,160,0.70); }
<head>〜</head>に以下を入れておいて、 <meta name="apple-mobile-web-app-capable" content="yes" />
<script language="JavaScript"> if(window.navigator.standalone){ document.write('ホーム画面のアイコン経由だね'); }else{ document.write('普通にSafariでアクセスしたね'); } </script>
body { -webkit-transform-style: preserve-3d; }