[欣赏代码片段] (JavaScript) Responsive jQuery

jQuery(document).ready(function($) {
  /* getting viewport width*/
  var responsive_viewport = $(window).width();
  
  /* if is below 481px */
  if(responsive_viewport < 481) {
  
  } /* end smallest screen*/
  
  /* if is larger than 481px */
  if (responsive_viewport > 481) {
        
  } /* end larger than 481px */
  
  /* if is above or equal to 768px */
  if (responsive_viewport >= 768) {
        
  }
  
  /* off the bat large screen actions */
  if (responsive_viewport > 1030) {
    
  }
  
  // add all your scripts here
  
}); /* end of as page load scripts */

使用Responsive jQuery在JavaScript层面上,能够很好的改善用户在不同设备(Desktop, Tablet,  Mobile)上的用户体验,值得拥有!

posted @ 2013-07-12 12:22  书生小C  阅读(221)  评论(0编辑  收藏  举报