8. @media only screen and (max-width: 768px) {
/*螢幕寬度768載入*/
}
@media only screen and (max-width: 600px) {
/*螢幕寬度600載入*/
}
@media only screen and (max-width: 480px) {
/*螢幕寬度480載入*/
}
傳統作法
12. 在js裡判定
ctrl.startup = function () {
var bi = '<%=JSON.stringify(bi)%>';
var bi_json = JSON.parse(bi);
if (bi_json .client.category == 'mobile') {
// mobile class
}
else if (bi_json .client.category == tablet') {
//tablet class
}
else {
// website class
}
}
13. 直接在html裡面判定
<% if (bi.client.category === 'mobile') { %>
<h2 class="mobile">This is mobile</h2>
<% } else if (bi.client.category === 'tablet') { %>
<h2 class=“tablet">This is tablet</h2>
<% } else { %>
<h2 class="desktop">This is desktop</h2>
<% } %>