support iframe responsive and fullscreen iframe(支持iframe自适应,并全屏iframe)
###################################################################
1.use jquery iframe resizer(it will autoresize iframe when content change)
and more fullscreen a iframe
2.user jquery fullscreen plugin
here ,the problem is iframe resizer set the iframe's scrolling="no",so in fullscreen,when content is more than 1 screen, there is no scroll bar.
so before you call $(iframe).fullscreen(),set iframe.scrolling="auto".
3.when exit fullscreen ,we need to set scrolling="no" ,otherwise it will continue response but ugly because of the scroll bar.
so ,we detect the fullscreen state,where exit fullscreen ,we set iframe's scrolling attribute to "no".
I write the content in iframe's container page as followes:
/*
* detect fullsreen state,when is no full screen , just set the iframe.scrolling="no";
*/
function onFullscreenchange(e) {
// Mode has changed.
console.log("onFullscreenchange");
/**
* Prior to Internet Explorer 11 not implemented
IE11 msFullscreenElement
Microsoft Edge and beyond fullscreenElement
*/
if (document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement||document.fullscreenElement)
{
/* Run code on exit */
}else{//exit fulscreen, set current iframe scrolling = no
if(lastFullScreenIframe!=null && lastFullScreenIframe!=undefined)
{
lastFullScreenIframe[0].scrolling="no";//no in fullscreen mode ,set scrolling no
}
}
}
jQuery(document).ready(function() {
document.addEventListener("fullscreenchange", onFullscreenchange, false);
document.addEventListener("webkitfullscreenchange", onFullscreenchange, false);
document.addEventListener("mozfullscreenchange", onFullscreenchange, false);
document.addEventListener("MSFullscreenChange", onFullscreenchange, false);//ie 11
});
have fun ,any problem mail me xiaohelong2005@gmail.com
########################################################################
the follow is in chinese:
iframe resizer plugin: https://github.com/davidjbradshaw/iframe-resizer
jquery fullscreen plugin: https://github.com/kayahr/jquery-fullscreen-plugin
自已写的侦测全屏事件函数等.
过程说明:
1.按iframe resizer方式实现好。(需要注意的是,每新增一个iframe,需要调用一次初始化函数)
2.按jquery fullpage方式实现好iframe全屏(获取到该iframe对像,调用fullpage)
3.此时虽然已经能在非全屏模式正常工作,但是在全屏方式,内容较多时确并不会出现滚动条。
解决如下:
在$(iframe).fullpage()调用前,设定iframe.scrolling="auto",并用lastFullScreenIframe记下最近一个iframe(多tab情况下)
解决了全屏模式下的滚动条问题,但是在非全屏下我们又必须将scrolling="no"关闭。解决思路如下:
监测全屏事件,当退出全屏时设定iframe.scrolling="no".
在iframe的父亲框架中,加入以下功能:
/*
* detect fullsreen state,when is no full screen , just set the iframe.scrolling="no";
*/
function onFullscreenchange(e) {
// Mode has changed.
console.log("onFullscreenchange");
/**
* Prior to Internet Explorer 11 not implemented
IE11 msFullscreenElement
Microsoft Edge and beyond fullscreenElement
*/
if (document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement||document.fullscreenElement)
{
/* Run code on exit */
}else{//exit fulscreen, set current iframe scrolling = no
if(lastFullScreenIframe!=null && lastFullScreenIframe!=undefined)
{
lastFullScreenIframe[0].scrolling="no";//no in fullscreen mode ,set scrolling no
}
}
}
jQuery(document).ready(function() {
document.addEventListener("fullscreenchange", onFullscreenchange, false);
document.addEventListener("webkitfullscreenchange", onFullscreenchange, false);
document.addEventListener("mozfullscreenchange", onFullscreenchange, false);
document.addEventListener("MSFullscreenChange", onFullscreenchange, false);//ie 11
});

HTML是構建網頁結構的基石。 1.HTML定義內容結構和語義,使用、、等標籤。 2.提供語義化標記,如、、等,提升SEO效果。 3.通過標籤實現用戶交互,需注意表單驗證。 4.使用、等高級元素結合JavaScript實現動態效果。 5.常見錯誤包括標籤未閉合和屬性值未加引號,需使用驗證工具。 6.優化策略包括減少HTTP請求、壓縮HTML、使用語義化標籤等。

HTML是一種用於構建網頁的語言,通過標籤和屬性定義網頁結構和內容。 1)HTML通過標籤組織文檔結構,如、。 2)瀏覽器解析HTML構建DOM並渲染網頁。 3)HTML5的新特性如、、增強了多媒體功能。 4)常見錯誤包括標籤未閉合和屬性值未加引號。 5)優化建議包括使用語義化標籤和減少文件大小。

WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。

HTML的作用是通過標籤和屬性定義網頁的結構和內容。 1.HTML通過到、等標籤組織內容,使其易於閱讀和理解。 2.使用語義化標籤如、等增強可訪問性和SEO。 3.優化HTML代碼可以提高網頁加載速度和用戶體驗。

htmlisaspecifictypefodyfocusedonstructuringwebcontent,而“代碼” badlyLyCludEslanguagesLikeLikejavascriptandPytyPythonForFunctionality.1)htmldefineswebpagertuctureduseTags.2)“代碼”代碼“ code” code code code codeSpassSesseseseseseseseAwiderRangeLangeLangeforLageforLogageforLogicIctInterract

HTML、CSS和JavaScript是Web開發的三大支柱。 1.HTML定義網頁結構,使用標籤如、等。 2.CSS控製網頁樣式,使用選擇器和屬性如color、font-size等。 3.JavaScript實現動態效果和交互,通過事件監聽和DOM操作。

HTML定義網頁結構,CSS負責樣式和佈局,JavaScript賦予動態交互。三者在網頁開發中各司其職,共同構建豐富多彩的網站。

HTML適合初學者學習,因為它簡單易學且能快速看到成果。 1)HTML的學習曲線平緩,易於上手。 2)只需掌握基本標籤即可開始創建網頁。 3)靈活性高,可與CSS和JavaScript結合使用。 4)豐富的學習資源和現代工具支持學習過程。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

Dreamweaver Mac版
視覺化網頁開發工具

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

WebStorm Mac版
好用的JavaScript開發工具

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中