この記事では、JS画像の時限ロール効果を実装する方法について説明します。次のように、参照のために共有してください。
<!doctype html public " - // w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <meta http-equiv = " effect </title> <style type = "text/css">。オーバーフロー:隠し;高さ:100px;幅:300px; } .box {float:left;フォントサイズ:12px;幅:80px;高さ:120px;オーバーフロー:隠し;位置:絶対; } </style> <スクリプト言語= "javascript" type = "text/javascript"> var t; window.onload = function(){var o = document.getElementById( 'box'); t = window.setinterval(function(){scrollup(o、24、0);}、3000)} ///スクロールメソッド///パラメーター:oスクロールブロックオブジェクト///パラメーター:d各スクロールの高さ///パラメーター: getFirstchild(o.firstchild).clonenode(true); O.RemoveChild(getFirstchild(o.firstchild)); O.AppendChild(T); t.style.margintop = "0px"; } else {c += 1; getFirstchild(o.firstchild).style.margintop = -c + "px"; window.settimeout(function(){scrollup(o、d、c)}、15); }} // firefox関数のノードとしてスペースが返される問題を解決しますgetFirstchild(node){while(node.nodetype!= 1){node = node.nextsibling; }ノードを返します。 } </script> </head> <body>スクロールタイミング効果デモ<hr> <div> <div id = "box"> <div> <img src = "../ img/head/1.png"/> </div> <div> </div> <div> <img src = "../ img/head/4.png"/> </div> </div> </div> </body> </html>JavaScript関連のコンテンツの詳細については、このサイトのトピックをご覧ください:「JavaScriptの切り替え効果とテクニックの要約」、「JavaScript検索アルゴリズムスキルの要約」、「JavaScriptアニメーション効果とテクニックの概要」、「Javascriptエラー、および「Javascriptデータ構造」の概要」の概要の要約の要約をご覧ください。 JavaScriptトラバーサルアルゴリズムとテクニック」、および「JavaScriptの数学的操作の使用法の要約」
この記事がみんなのJavaScriptプログラミングに役立つことを願っています。