2016年8月10日のブックマーク (1件)

  • jQueryでiPhone/iPadの向きを検出する[to-R]

    jQueryでiPhone/iPadの向きを検出する iPhone/iPadで向きの概念が存在し、横向き(landscape)と縦向き(portrait)によって幅が変わるのでデザインやスクリプトを変更することがあります。 そういった場合に利用できるのがメディアクエリーのorientationです。 <link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css"> <link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css"> このように記述をすると縦向き(portrait)の場合はportrait.cssを横向き(landscape)の場合はlandscape.cssを読み込むことが出

    jQueryでiPhone/iPadの向きを検出する[to-R]
    daizo1117
    daizo1117 2016/08/10
    “$(window).bind("load orientationchange",function(){ if(Math.abs(window.orientation) === 90){ $("body").html("横向き");//横向きの場合の命令 }else{ $("body").html("縦向き");//縦向きの場合の命令 } })”