Este artigo descreve a simples implementação de efeitos de janela flutuantes por JS. Compartilhe -o para sua referência, como segue:
Parte HTML:
<! xmlns = "http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> title preenchimento: 0;} a img {borda: 0;} </style> </ad Head> <body> <div style = "altura: 2000px; fundo: #ccc; display: nenhum;"> </div> <!-div id = "floatad" style = "posição: fixo! _top: Expressão (Document.DocumentElement.Scrolltop+Document.DocumentElement.ClientHeight This.OffsetHeight); sem repetição; style = "largura: 26px; altura: 26px; float: direita;"> </div> <div onclick = "open_online ();"> </div> </div> <div id = "floatside" style = "largura: 141px; altura: 579px; posição: fixa! _top: Expressão (Document.DocumentElement.Scrolltop+Document.DocumentElement.ClientHeight This.OffSethEight); OnClick = "Open_Online ();> </div-> </body> </html> <script type =" text/javascript "src =" online.js "> </sCript>Parte do JS:
// Javascript Document // Imagem de publicidade flutuante var floatadimg = "Images/onLinesay.jpg"; // Imagem da barra lateral flutuante var floatsideImg = "imagens/onlineTel.gif"; // Abra a função de comunicação on -line Open_online () { window.open ('http://p.qiao.baidu.com//im/index?siteid=7342332&ucid=7601325');} // flutuante document.writeln ("<div id =/" floatad/"style =/" position: fixo! _top: Expressão (Document.DocumentElement.Scrolltop+Document.DocumentEless.ClientHeight This.OffsetHeight); NO-repetição; estilo =/"largura: 487px; altura: 320px; flutuação: direita;/" OnClick =/"open_online ();/"> </div> "); document.writeln (" </div> "); // flutuante na barra lateral document.writeln (" <div estilo; _top: Expressão (Document.DocumentElement.Scrolltop+Document.DocumentElement.ClientHeight This.OffSethEight); Função de publicidade flutuante CloseFad () {document.getElementById ('floatadad'). style.display = 'none';} // Abra a função de anúncio flutuante Showfad () {document.getElementById ('floatad'). style.display = 'block';} // Função de janela flutuante ShowFloat () {Display = 'Block';} // Aberta da função flutuante ShowFloat () {Display = 'Block';} // = 'Block';} // Abra a função da janela Showfloat () {Document.getElementById ('Floatad'). style.display = 'Block';} // Abra a janela por 20 segundos e apenas Execute Settimeout uma vez (Showfad, 20000); // Abra SetVal (Showfloat, 30000);As renderizações são as seguintes:
For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript Traversal Algorithm and Skills", "Summary of JavaScript Switching Special Effects and Skills", "Summary of JavaScript Search Algorithm Skills", "Summary of JavaScript Animation Special Effects and Skills", "Summary of JavaScript Errors and Debugging Skills", "Summary of JavaScript Data Estruturas e habilidades de algoritmo "e" Resumo do uso de operação matemática de JavaScript "
Espero que este artigo seja útil para a programação JavaScript de todos.