HTML5全屏代码片段

jopen 11年前

fullScreen:function(){     var fullTarget=$(".fullScreen")[0];          if(fullTarget.webkitRequestFullScreen){      fullTarget.webkitRequestFullScreen();     }     else if(fullTarget.mozRequestFullScreen){      fullTarget.mozRequestFullScreen();     }     else if(fullTarget.requestFullscreen){      fullTarget.requestFullscreen();     }     else if(navigator.userAgent.indexOf('MSIE')>-1){      $("body").removeClass('fullScreen');      var href=document.location.href;      if(href.indexOf("fullscreen")>-1) window.open(href,"","fullscreen,scrollbars=no,Resizable=no");      else window.open(href+"fullscreen","","fullscreen,scrollbars=no,Resizable=no");     }               },    existFullScreen:function(){     if(document.webkitIsFullScreen){      document.webkitCancelFullScreen();     }     else if(document.mozFullScreen){      document.mozCancelFullScreen();     }     else if(document.fullScreen){      document.cancelFullScreen();     }     else{      self.close();     }    },    fullScreenListen:function(){     $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange',function(){      if (document.mozFullScreen ||document.webkitIsFullScreen ){       $("body").addClass('fullScreen');      }      else{       $("body").removeClass('fullScreen');      }     });     },