日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

弹框提示

發(fā)布時(shí)間:2025/3/12 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 弹框提示 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

jquery彈框提示框的實(shí)現(xiàn)。

原理分析
1.點(diǎn)擊按鈕出現(xiàn)彈框
2.設(shè)置彈框標(biāo)題和內(nèi)容
3.設(shè)置取消和確定兩個(gè)按鈕
4.點(diǎn)擊確定繼續(xù)執(zhí)行
5.點(diǎn)擊取消返回此頁(yè)面

效果演示

原始樣式

點(diǎn)擊之后

點(diǎn)擊確認(rèn)按鈕

代碼演示

在開(kāi)始我們的程序之前注意:
引入Jquery.js架包

<script type="text/javascript" src="js/jquery.js"></script>

完整代碼展示

html頁(yè)面

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jQuery彈框</title><link rel="stylesheet" href="css/tankuang.css" /><script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/tankuang.js" ></script></head> <body> <center> <button onClick="$.myConfirm({title:'提示框標(biāo)題',message:'提示框內(nèi)容',callback:function(){alert('true')}})">點(diǎn)擊跳出彈框</button><br/><br/> </center></body> </html>

css樣式

* {margin: 0;padding: 0; } button{width: 100px;height: 30px;border: 1px solid cyan;margin-top: 100px;border-radius: 10px; }.clearfix:after {content: '';display: table;width: 100%;clear: both; }.myModa {position: fixed;top: 0;left: 0;bottom: 0;right: 0;background: rgba(0, 0, 0, 0.2); }.myModa .myAlertBox {width: 300px;border-radius: 5px;border: 1px solid #d9d9d9;background: #CAE3FF;overflow: hidden;margin: 0 auto; }.myModa .myAlertBox h6 {background: #EEEBEB;padding: 10px;line-height: 20px;font-size: 17px;text-align: center; }.myModa .myAlertBox p {padding: 20px;line-height: 26px;font-size: 16px;color: #FF4783; }.myModa .myAlertBox .btn {cursor: pointer;width: 80px;line-height: 36px;border-radius: 5px;text-align: center;font-size: 16px;margin: 0 auto;margin-bottom: 20px;background: #CAA2EC; } .myModa .myAlertBox .btn:hover{background-color: #A032CF; }.myModa .myAlertBox .col2 .col {width: 100px;float: left; }.myModa .myAlertBox .col2 .col .btn {width: 100%; }.myModa .myAlertBox .col2 {padding: 0 40px; }

script內(nèi)容

(function() {$.extend({myConfirm: function(options) {var option = {title: "標(biāo)題",message: "內(nèi)容",callback: function() {}}if (typeof(options) == "string") {option.message = options} else {option = $.extend(option, options);}var top = $(window).height() * 0.3;$('body').append('<div class="myModa"><div class="myAlertBox" style="margin-top:' + top + 'px"><h6>' + option.title +'</h6><p>' + option.message +'</p><div class="col2"><div class="col" style="margin-right: 20px;"><div class="btn exit">取消</div></div><div class="col"><div class="btn sure">確定</div></div></div></div></div>');$('.btn.exit').click(function() {$('.myModa').remove();})$('.btn.sure').click(function() {$('.myModa').remove();option.callback();})}}); })(jQuery)

到此此彈框提示已經(jīng)完整結(jié)束,趕快去練習(xí)吧。

掃一掃關(guān)注我的公眾號(hào)獲取更多資訊呦!!!

總結(jié)

以上是生活随笔為你收集整理的弹框提示的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。