Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How the front-end video tag enters and exits the full screen

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This "front-end video tags how to enter full-screen and exit full-screen" article most people do not understand, so the editor summed up the following content, detailed, clear steps, with a certain reference value, I hope you can get something after reading this article, let's take a look at this "front-end video tags how to enter full-screen and exit full-screen" article.

Different browsers have different implementations:

/ / Webkitelement.webkitRequestFullScreen (); / / enter full screen document.webkitCancelFullScreen (); / / exit full screen / / Firefoxelement.mozRequestFullScreen (); document.mozCancelFullScreen (); / / W3C element.requestFullscreen (); document.exitFullscreen ()

In general compatibility, we first use the W3C standard method, if it is not compatible with different browsers.

/ / enter full screen function FullScreen () {var ele = document.documentElement; if (ele.requestFullscreen) {ele.requestFullscreen ();} else if (ele.mozRequestFullScreen) {ele.mozRequestFullScreen ();} else if (ele.webkitRequestFullScreen) {ele.webkitRequestFullScreen ();}} / exit full screen function exitFullscreen () {var de = document; if (de.exitFullscreen) {de.exitFullscreen () } else if (de.mozCancelFullScreen) {de.mozCancelFullScreen ();} else if (de.webkitCancelFullScreen) {de.webkitCancelFullScreen ();}}

Here are the use cases:

$(ele) .on ('click',function () {FullScreen (); / / exitFullscreen ();}); the above is about "how the front-end video tags enter and exit the full screen". I believe you all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report