アラートと確認の CSS シミュレーション実装実装_html/css_WEB-ITnose
ネイティブのアラートと確認の表示スタイルは携帯電話ごとに異なり、また見苦しいからです。したがって、CSS を使用してネイティブ アラートをシミュレートし、実装を確認しました。
具体的なコードは次のとおりです:
<!DOCTYPE html><html><head><title>confirm和alert的demo</title><meta charset="UTF-8"><script src="jquery.min.js"></script><style type="text/css">/*w-error-popup-white*/.w-error-popup-white{ width: 100%; height: 100%; z-index: 999; position: fixed; left: 0; top:0;}.w-error-popup-white .w-error-back{ width: 100%; height: 100%; background-color: rgba(0,0,0,.8); position:fixed; z-index: 1000; left: 0; top:0;}.w-error-popup-white .w-error-inner{ background-color: #fff; width: 90%; top: 15%; left: 50%; margin-left: -45%; text-align: center; border-radius: 20px; padding: 0; z-index: 1001; position: relative;}.w-error-popup-white .w-error-inner h4{ font-size: 20px; color: #333; padding: 16px 0; margin: 0 32px; border-bottom: 1px solid #e5e9ec; font-weight: normal; }.w-error-popup-white .w-error-inner .w-error-content{ color: #333; font-size: 16px; line-height: 45px; padding: 32px; height: 270px; overflow-y:auto; overflow-x:hidden; text-align: left; }.w-close{ background: url(../images/result-error-x.png) no-repeat right 16px; float: right; right:18px; top:0; position:absolute; z-index: 999; width: 100px; height:85px; cursor:pointer; display: block; background-size:60%;}/*u-btn */.u-btn{ padding: 16px 80px; background-color: #92c153; border-bottom: 5px solid #7da646; border-radius: 8px; color: #fff; display: inline-block; vertical-align: middle;}.u-btn-red{ background-color: #ec7d69; border-color: #e95c44;}</style></head><body><input type="button" value="模拟confirm" id="confirmId" onclick="confirmClickMethed()"/><input type="button" value="模拟alert" id="alertId" onclick="alertClickMethed()"/> <!-- 所有页面都共享confirm提示框 --> <div id="w-error-popup-white" style="display: none;" class="w-error-popup-white"> <div class="w-error-back"></div> <div class="w-error-inner"> <div id="w-confirm-content" class="w-error-content" style="height: auto; font-size: 26px;"> 取消后不能恢复,确定取消么?</div> <div class="btn" style="padding: 1rem; text-align: right;"> <a class="u-btn u-btn-red" href="javascript:canclePopup();">取消</a> <a id="sure" class="u-btn" href="javascript:sure();">确定</a> </div> </div> </div> <!-- 所有页面都共享alert提示框 --> <div id="w-alert-popup-white" style="display: none;" class="w-error-popup-white"> <div class="w-error-back"></div> <div class="w-error-inner"> <div id="w-alert-content" class="w-error-content" style="height: auto; font-size: 26px;"> 这是提示内容 </div> <div class="btn" style="padding: 1rem; text-align: right;"> <a class="u-btn u-btn-red" href="javascript:alertHide();">确定</a> </div> </div> </div> <script type="text/javascript"> function sure(){ $("#w-error-popup-white").hide(); alert("确定"); }function canclePopup(){ $("#w-error-popup-white").hide();}function alertHide(){ $("#w-alert-popup-white").hide();}function confirmClickMethed(){ $("#w-confirm-content").html("这是一个confirm内容,取消还是确认呢?"); $("#w-error-popup-white").show();}function alertClickMethed(){ $("#w-alert-content").html("这是一个alert内容"); $("#w-alert-popup-white").show();}</script></body></html>
ファイルには jquery を導入する必要があります。ダウンロードアドレス:
リンク: http://pan.baidu.com/s/1qWxOoC8 パスワード: w541

ホットAIツール

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

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

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

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

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









HTMLは、簡単に学習しやすく、結果をすばやく見ることができるため、初心者に適しています。 1)HTMLの学習曲線はスムーズで簡単に開始できます。 2)基本タグをマスターして、Webページの作成を開始します。 3)柔軟性が高く、CSSおよびJavaScriptと組み合わせて使用できます。 4)豊富な学習リソースと最新のツールは、学習プロセスをサポートしています。

HTMLはWeb構造を定義し、CSSはスタイルとレイアウトを担当し、JavaScriptは動的な相互作用を提供します。 3人はWeb開発で職務を遂行し、共同でカラフルなWebサイトを構築します。

Anexampleapalofastartingtaginhtmlis、それはaperginsaparagraph.startingtagsaresentionentientiontheyinitiateelements、definetheirtypes、およびarecrucialforurturingwebpagesandcontingthomedomを構築します。

webdevelopmentReliesOnhtml、css、andjavascript:1)htmlStructuresContent、2)cssStylesit、および3)Javascriptaddsinteractivity、形成、

GiteEpages静的Webサイトの展開が失敗しました:404エラーのトラブルシューティングと解像度Giteeを使用する

Y軸位置Webアノテーション機能の適応アルゴリズムこの記事では、単語文書と同様の注釈関数、特に注釈間の間隔を扱う方法を実装する方法を探ります...

画像をクリックした後、散乱と周囲の画像を拡大する効果を実現するには、多くのWebデザインがインタラクティブな効果を実現する必要があります。特定の画像をクリックして周囲を作成してください...

Vueアプリケーションを開発するときに、ルーターフォルダーの下にindex.jsファイルにvuerouterを登録する必要性があるため、ルーティング構成で問題が発生することがよくあります。特別...
