继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

jquery全屏模式插件

慕粉0415482673
关注TA
已关注
手记 297
粉丝 64
获赞 367

项目地址:https://github.com/martinaglv/jQuery-FullScreen


How to use

Include jquery.fullscreen.js in your page along with version 1.7 of the jQuery library. This gives you the$('#elem').fullScreen() method. You can optionally pass an object with properties:

PropertyValueMeaning
backgrounda color hashThis is the color that will be used for the background.
callbacka functionThe callback function will be called on a full screen change event. It has one argument - a boolean indicating whether we are in full screen or not.
fullscreenClassa stringThis is the CSS class that will be added to elements in fullscreen mode. The default class is "fullScreen".

After the plugin makes your element full screen, it will add the fullScreen class on it (unless overridden with the fullscreenClass parameter), so you can easily style it.

Example

// The plugin sets the $.support.fullscreen flag:if($.support.fullscreen){// ...// Show your full screen button here// ...$('#fullScreen').click(function(e){$('#content').fullScreen();// You can also pass a hash with properties:// $('#content').fullScreen({//  'background'    : '#111',//  'callback'      : function(isFullScreen){//      // ...//      // Do some cleaning up here//      // ...//  }// });});}

You can then apply additional styles to your element. Take the opportunity to increase the font size, hide distractions and make for a better reading experience.

#content.fullScreen{/* Give the element a width and margin:0 auto; to center it. */}

If you later wish to cancel the full screen view, you can do so by calling the fullScreen() method again.


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP

热门评论

试验了一下,在谷歌里面好用,在ie中不行呢?求教

查看全部评论