網頁設計

2014年12月27日 星期六

javascript jquery 判斷是否手機版、平板、mac、pc include 相對應 js 響應式用



if( !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
  // not mobile
  if (navigator.userAgent.indexOf('Mac OS X') != -1) {
     //is Mac
  } else {
     //is PC
   }
}else{
  // is mobile
}

用 jquery load 外部 js
$.getScript( "js/SmoothScroll.js" );

0 意見 :

張貼留言