この記事の例では、jQuery による情報プロンプト ボックス効果の実装について説明します。皆さんの参考に共有してください。詳細は以下の通りです。
jquery プロンプト ボックスの特殊効果、黒のスタイル。プロンプト ボックスはページの中央にあるいくつかの単語をクリックすると、動的に表示されます。多くの CSS と JS があります。コード。
まずランニング効果を見てみましょう:
具体的なコードは次のとおりです:
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery实现的非常人性化的提示信息框效果</title> <script type="text/javascript" src="jquery-1.6.2.min.js"></script> <script type="text/javascript"> var humanMsg = { setup: function(appendTo, logName, msgOpacity) { humanMsg.msgID = 'humanMsg'; humanMsg.logID = 'humanMsgLog'; if (appendTo == undefined) appendTo = 'body'; if (logName == undefined) logName = 'Message Log'; humanMsg.msgOpacity = .8; if (msgOpacity != undefined) humanMsg.msgOpacity = parseFloat(msgOpacity); jQuery(appendTo).append('<div id="'+humanMsg.msgID+'" class="humanMsg"><div class="round"></div><p></p><div class="round"></div></div> <div id="'+humanMsg.logID+'"><p>'+logName+'</p><ul></ul></div>') jQuery('#'+humanMsg.logID+' p').click( function() { jQuery(this).siblings('ul').slideToggle() } ) }, displayMsg: function(msg) { if (msg == '') return; clearTimeout(humanMsg.t2); jQuery('#'+humanMsg.msgID+' p').html(msg) jQuery('#'+humanMsg.msgID+'').show().animate({ opacity: humanMsg.msgOpacity}, 200, function() { jQuery('#'+humanMsg.logID) .show().children('ul').prepend('<li>'+msg+'</li>') .children('li:first').slideDown(200) if ( jQuery('#'+humanMsg.logID+' ul').css('display') == 'none') { jQuery('#'+humanMsg.logID+' p').animate({ bottom: 40 }, 200, 'linear', function() { jQuery(this).animate({ bottom: 0 }, 300, 'easeOutBounce', function() { jQuery(this).css({ bottom: 0 }) }) }) } }) humanMsg.t1 = setTimeout("humanMsg.bindEvents()", 700) humanMsg.t2 = setTimeout("humanMsg.removeMsg()", 5000) }, bindEvents: function() { jQuery(window) .mousemove(humanMsg.removeMsg) .click(humanMsg.removeMsg) .keypress(humanMsg.removeMsg) }, removeMsg: function() { // Unbind mouse & keyboard jQuery(window) .unbind('mousemove', humanMsg.removeMsg) .unbind('click', humanMsg.removeMsg) .unbind('keypress', humanMsg.removeMsg) if (jQuery('#'+humanMsg.msgID).css('opacity') == humanMsg.msgOpacity) jQuery('#'+humanMsg.msgID).animate({ opacity: 0 }, 500, function() { jQuery(this).hide() }) } }; jQuery(document).ready(function(){ humanMsg.setup(); }) </script> <style> html, body { height: 100%; /* Damn you IE! */ } .humanMsg { font: normal 20px/50px Helvetica, Arial, Sans-Serif; letter-spacing: -1px; position: fixed; top: 130px; left: 25%; width: 50%; color: white; background-color: black; text-align: center; display: none; opacity: 0; z-index: 100000; } .humanMsg .round { border-left: solid 2px white; border-right: solid 2px white; font-size: 1px; height: 2px; } .humanMsg p { padding: .3em; display: inline; } .humanMsg a { display: none; } #humanMsgLog { font: normal 10px Helvetica, Arial, Sans-Serif; color: white; position: fixed; bottom: 0; left: 0; width: 100%; max-height: 200px; display: none; z-index: 10000; } #humanMsgLog p { position: relative; left: 50%; width: 200px; margin: 0; margin-left: -100px; padding: 0 10px; line-height: 20px; background: #333; text-align: center; white-space: pre; cursor: pointer; } #humanMsgLog p:hover { background: #222; } #humanMsgLog ul { margin: 0; padding: 0; position: relative; max-height: 180px; overflow: auto; display: none; } #humanMsgLog ul li { color: #555; font-size: 12px; list-style-type: none; border-bottom: 1px solid #ddd; line-height: 40px; display: none; padding: 0 20px; position: relative; overflow: hidden; white-space: pre; } #humanMsgLog ul li:hover { background: #f2f2f2; } #humanMsgLog ul li:first-child { margin-top: 1px; } #humanMsgLog ul li .error { color: orangered; } #humanMsgLog ul li .indent { position: absolute; top: 0; left: 100px; margin-right: 200px; height: inherit; } </style> <script> jQuery(document).ready(function() { jQuery('a.showmessage').click(function() { humanMsg.displayMsg('<strong>Success:</strong> <span class="indent">You clicked \''+jQuery(this).text()+'\'</span>'); return false; }) jQuery('a.showmessage:last').click(function() { humanMsg.displayMsg('"Your <strong>Earth</strong> will be reduced to a burned-out cinder."'); return false; }) }) </script> <style> p.links { position: absolute; font: 2em Helvetica, Arial, Sans-Serif; top: 40%; left: 50%; width: 400px; margin-left: -200px; text-align: center; } p.links a { text-decoration: none; color: #888; } p.links a:hover { color: #222; } p.links a.home { font-size: 10px; line-height: 30px; } </style> </head> <body> <p class="links"> <a href="#" class="showmessage">Klaatu</a> <a href="#" class="showmessage">Barada</a> <a href="#" class="showmessage">Nikto</a><br /> <a href="http://www.jb51.net/" class="home">Humanized Messages</a> </p> </body> </html>
この記事が皆さんの jquery プログラミング設計に役立つことを願っています。

JavaScriptの最新トレンドには、TypeScriptの台頭、最新のフレームワークとライブラリの人気、WebAssemblyの適用が含まれます。将来の見通しは、より強力なタイプシステム、サーバー側のJavaScriptの開発、人工知能と機械学習の拡大、およびIoTおよびEDGEコンピューティングの可能性をカバーしています。

JavaScriptは現代のWeb開発の基礎であり、その主な機能には、イベント駆動型のプログラミング、動的コンテンツ生成、非同期プログラミングが含まれます。 1)イベント駆動型プログラミングにより、Webページはユーザー操作に応じて動的に変更できます。 2)動的コンテンツ生成により、条件に応じてページコンテンツを調整できます。 3)非同期プログラミングにより、ユーザーインターフェイスがブロックされないようにします。 JavaScriptは、Webインタラクション、シングルページアプリケーション、サーバー側の開発で広く使用されており、ユーザーエクスペリエンスとクロスプラットフォーム開発の柔軟性を大幅に改善しています。

Pythonはデータサイエンスや機械学習により適していますが、JavaScriptはフロントエンドとフルスタックの開発により適しています。 1. Pythonは、簡潔な構文とリッチライブラリエコシステムで知られており、データ分析とWeb開発に適しています。 2。JavaScriptは、フロントエンド開発の中核です。 node.jsはサーバー側のプログラミングをサポートしており、フルスタック開発に適しています。

JavaScriptは、最新のブラウザにすでに組み込まれているため、インストールを必要としません。開始するには、テキストエディターとブラウザのみが必要です。 1)ブラウザ環境では、タグを介してHTMLファイルを埋め込んで実行します。 2)node.js環境では、node.jsをダウンロードしてインストールした後、コマンドラインを介してJavaScriptファイルを実行します。

Quartzタイマーを使用してタスクをスケジュールする場合、Quartzでタスク通知を事前に送信する方法、タスクの実行時間はCron式によって設定されます。今...

JavaScriptプログラミング、プロトタイプチェーンの関数パラメーターの理解と操作のJavaScriptのプロトタイプチェーンの関数のパラメーターを取得する方法は、一般的で重要なタスクです...

WeChatアプレットWeb-ViewでVue.jsを使用する動的スタイルの変位障害がvue.jsを使用している理由の分析...

複数のリンクの同時ゲットリクエストを作成し、結果を返すために順番に判断する方法は? TamperMonkeyスクリプトでは、複数のチェーンを使用する必要があることがよくあります...


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

mPDF
mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

MantisBT
Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

SublimeText3 中国語版
中国語版、とても使いやすい

Safe Exam Browser
Safe Exam Browser は、オンライン試験を安全に受験するための安全なブラウザ環境です。このソフトウェアは、あらゆるコンピュータを安全なワークステーションに変えます。あらゆるユーティリティへのアクセスを制御し、学生が無許可のリソースを使用するのを防ぎます。

ホットトピック



