1. 横幅をデバイスの幅にあわせる
<meta name="viewport" content="width=device-width, initial-scale=1.0">
(
function
(){
var
ua = navigator.userAgent.toUpperCase();
var
url = document.location.pathname;
var
spDir =
'/sp/'
;
(ua.indexOf(
'IPHONE'
) != -1 || (ua.indexOf(
'ANDROID'
) != -1 && ua.indexOf(
'MOBILE'
) != -1))?
isSP() :
isPC();
function
isSP(){
if
(url.match(spDir)){
return
false
;
}
else
{
location.href = spDir;
}
}
function
isPC(){
if
(!url.match(spDir)){
return
false
;
}
else
{
location.href =
'/'
;
}
}
0 件のコメント:
コメントを投稿