摘要:
-------------------------------tipswindown.js------------------------------ ///------------------------------------------------------------------------- //jQuery彈出窗口 By Await [2009-11-22] //-------------------------------------------------------------------------- /*參數(shù):[可選參數(shù)在調(diào)用時(shí)可寫可不寫,其他為必寫] ---------------------------------------------------------------------------- title: 窗口標(biāo)題 content: 內(nèi)容(可選內(nèi)容為){ text | id | img | url | iframe } width: 內(nèi)容寬度 height: 內(nèi)容高度 drag: 是否可以拖動(dòng)(ture為是,false為否) time: 自動(dòng)關(guān)閉等待的時(shí)間,為空是則不自動(dòng)關(guān)閉 showbg: [可選參數(shù)]設(shè)置是否顯示遮罩層(0為不顯示,1為顯示) cssName: [可選參數(shù)]附加class名稱 ------------------------------------------------------------------------*/ //示例: //------------------------------------------------------------------------ //simpleWindown("例子","text:例子","500","400","true","3000","0","exa") //------------------------------------------------------------------------ var showWindown = true; var templateSrc = "http://www.7daysinn.cn"; //設(shè)置loading.gif路徑 function tipsWindown(title,content,width,height,drag,time,showbg,cssName,backcall) { $("#windown-box").remove(); //請(qǐng)除內(nèi)容 var width = width>= 950?this.width=950:this.width=width; //設(shè)置最大窗口寬度 var height = height>= 527?this.height=527:this.height=height; //設(shè)置最大窗口高度 if(showWindown == true) { var simpleWindown_html = new String; simpleWindown_html = ""; simpleWindown_html += ""; simpleWindown_html += ""; $("body").append(simpleWindown_html); show = false; } contentType = content.substring(0,content.indexOf(":")); content = content.substring(content.indexOf(":")+1,content.length); switch(contentType) { case "text": $("#windown-content").html(content); break; case "id": $("#windown-content").html($("#"+content+"").html()); break; case "img": $("#windown-content").ajaxStart(function() { $(this).html(""); }); $.ajax({ error:function(){ $("#windown-content").html("關(guān)閉"; simpleWindown_html += ""; simpleWindown_html += "加載數(shù)據(jù)出錯(cuò)...
"); }, success:function(html){ $("#windown-content").html(""); } }); break; case "url": var content_array=content.split("?"); $("#windown-content").ajaxStart(function(){ $(this).html(""); }); $.ajax({ type:content_array[0], url:content_array[1], data:content_array[2], error:function(){ $("#windown-content").html("加載數(shù)據(jù)出錯(cuò)...
"); }, success:function(html){ $("#windown-content").html(html); if(backcall) backcall(); } }); break; case "iframe": $("#windown-content").ajaxStart(function(){ $(this).html(""); }); $.ajax({ error:function(){ $("#windown-content").html("加載數(shù)據(jù)出錯(cuò)...
"); }, success:function(html){ $("#windown-content").html(""); } }); } $("#windown-title h2").html(title); if(showbg == "true") {$("#windownbg").show();}else {$("#windownbg").remove();}; $("#windownbg").animate({opacity:"0.5"},"normal");//設(shè)置透明度 $("#windown-box").show(); if( height >= 527 ) { $("#windown-title").css({width:(parseInt(width)+22)+"px"}); $("#windown-content").css({width:(parseInt(width)+17)+"px",height:height+"px"}); }else { $("#windown-title").css({width:(parseInt(width)+10)+"px"}); $("#windown-content").css({width:width+"px",height:height+"px"}); } var cw = document.documentElement.clientWidth,ch = document.documentElement.clientHeight,est = document.documentElement.scrollTop; var _version = $.browser.version; if ( _version == 6.0 ) { $("#windown-box").css({left:"50%",top:(parseInt((ch)/2)+est)+"px",marginTop: -((parseInt(height)+53)/2)+"px",marginLeft:-((parseInt(width)+32)/2)+"px",zIndex: "999999"}); }else { $("#windown-box").css({left:"50%",top:"50%",marginTop:-((parseInt(height)+53)/2)+"px",marginLeft:-((parseInt(width)+32)/2)+"px",zIndex: "999999"}); }; var Drag_ID = document.getElementById("windown-box"),DragHead = document.getElementById("windown-title"); var moveX = 0,moveY = 0,moveTop,moveLeft = 0,moveable = false; if ( _version == 6.0 ) { moveTop = est; }else { moveTop = 0; } var sw = Drag_ID.scrollWidth,sh = Drag_ID.scrollHeight; DragHead.onmouseover = function(e) { if(drag == "true"){DragHead.style.cursor = "move";}else{DragHead.style.cursor = "default";} }; DragHead.onmousedown = function(e) { if(drag == "true"){moveable = true;}else{moveable = false;} e = window.event?window.event:e; var ol = Drag_ID.offsetLeft, ot = Drag_ID.offsetTop-moveTop; moveX = e.clientX-ol; moveY = e.clientY-ot; document.onmousemove = function(e) { if (moveable) { e = window.event?window.event:e; var x = e.clientX - moveX; var y = e.clientY - moveY; if ( x > 0 &&( x + sw < cw) && y > 0 && (y + sh < ch) ) { Drag_ID.style.left = x + "px"; Drag_ID.style.top = parseInt(y+moveTop) + "px"; Drag_ID.style.margin = "auto"; } } } document.onmouseup = function () {moveable = false;}; Drag_ID.onselectstart = function(e){return false;} } $("#windown-content").attr("class","windown-"+cssName); if( time == "" || typeof(time) == "undefined") { $("#windown-close").click(function() { showselect("t123_") $("#windownbg").remove(); $("#windown-box").fadeOut("slow",function(){$(this).remove();}); }); }else { setTimeout(closeWindown,time); } hideselect("t123_"); } var closeWindown = function() { showselect("t123_"); $("#windownbg").remove(); $("#windown-box").fadeOut("slow",function(){$(this).remove();}); } function hideselect(per) { var _version = $.browser.version; if ( _version == 6.0 ) { $("select",document).each(function(){ if($(this).attr("name")) { if($(this).attr("name").substring(0,5)==per) { name = $(this).attr("name").substring(5); $(this).attr("name",name); $(this).css("display",""); } if($(this).css("display")!="none") { name = per+$(this).attr("name"); $(this).attr("name",name); } $(this).css("display","none"); } }); } } function showselect(per) { var _version = $.browser.version; if ( _version == 6.0 ) { $("select",document).each(function(){ if($(this).attr("name")) { if($(this).attr("name").substring(0,5)==per) { name = $(this).attr("name").substring(5); $(this).attr("name",name); $(this).css("display",""); } } }); } } ---------------------------style.css---------------------------------- ---------------------------------html------------------------------
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/111346.html
摘要:在這個(gè)系列里分享一些簡(jiǎn)單,但是很有意思的交互效果附上地址和地址滾動(dòng),添加對(duì)應(yīng)加載的比如巧用實(shí)現(xiàn)文字和遮罩層的動(dòng)畫效果文字動(dòng)畫遮罩層動(dòng)畫首先然后把且,這樣就實(shí)現(xiàn)了遮罩層的進(jìn)場(chǎng)和退出效果隨機(jī)獲取數(shù)組項(xiàng) 在這個(gè)系列里分享一些簡(jiǎn)單,但是很有意思的交互效果~附上demo地址和github地址 showImg(https://makapicture.oss-cn-beijing.aliyuncs....
摘要:在這個(gè)系列里分享一些簡(jiǎn)單,但是很有意思的交互效果附上地址和地址滾動(dòng),添加對(duì)應(yīng)加載的比如巧用實(shí)現(xiàn)文字和遮罩層的動(dòng)畫效果文字動(dòng)畫遮罩層動(dòng)畫首先然后把且,這樣就實(shí)現(xiàn)了遮罩層的進(jìn)場(chǎng)和退出效果隨機(jī)獲取數(shù)組項(xiàng) 在這個(gè)系列里分享一些簡(jiǎn)單,但是很有意思的交互效果~附上demo地址和github地址 showImg(https://makapicture.oss-cn-beijing.aliyuncs....
摘要:背景官網(wǎng)有個(gè)對(duì)話框組件如圖如果哪天不能用框架了不能用組件了只能用原生寫頁面現(xiàn)在的我可能要一個(gè)頁面寫一年目標(biāo)用原生完成這個(gè)頁面彈框處于垂直居中狀態(tài)且點(diǎn)擊彈框外任意區(qū)域關(guān)閉彈框?qū)懥撕芫煤芫脮r(shí)間就不說了遇到的最難的問題就是不知道怎么關(guān)閉彈框后面還 背景:Ant官網(wǎng)有個(gè)對(duì)話框Model組件.如圖: showImg(https://segmentfault.com/img/bVbwMCG?w=1...
摘要:背景官網(wǎng)有個(gè)對(duì)話框組件如圖如果哪天不能用框架了不能用組件了只能用原生寫頁面現(xiàn)在的我可能要一個(gè)頁面寫一年目標(biāo)用原生完成這個(gè)頁面彈框處于垂直居中狀態(tài)且點(diǎn)擊彈框外任意區(qū)域關(guān)閉彈框?qū)懥撕芫煤芫脮r(shí)間就不說了遇到的最難的問題就是不知道怎么關(guān)閉彈框后面還 背景:Ant官網(wǎng)有個(gè)對(duì)話框Model組件.如圖: showImg(https://segmentfault.com/img/bVbwMCG?w=1...
摘要:在時(shí),亦可進(jìn)一步改變?cè)撜谡謱拥纳屎屯该鞫取U谡謱訉?shí)現(xiàn)及狀態(tài)丟失問題代碼代碼在時(shí),如果快速點(diǎn)擊鼠標(biāo),可能會(huì)丟失的效果。狀態(tài)丟失的簡(jiǎn)單解決方案基本思路是,點(diǎn)擊鼠標(biāo)時(shí)給添加,強(qiáng)制它顯示里的樣式。 CSS遮罩層,顧名思義就是在div上,再鋪一層半透明的div。在hover時(shí),亦可進(jìn)一步改變?cè)撜谡謱拥纳屎屯该鞫取N覀兛梢酝ㄟ^css定位和背景色實(shí)現(xiàn)。 CSS遮罩層實(shí)現(xiàn)及hover狀態(tài)丟失問題 ...
摘要:在時(shí),亦可進(jìn)一步改變?cè)撜谡謱拥纳屎屯该鞫取U谡謱訉?shí)現(xiàn)及狀態(tài)丟失問題代碼代碼在時(shí),如果快速點(diǎn)擊鼠標(biāo),可能會(huì)丟失的效果。狀態(tài)丟失的簡(jiǎn)單解決方案基本思路是,點(diǎn)擊鼠標(biāo)時(shí)給添加,強(qiáng)制它顯示里的樣式。 CSS遮罩層,顧名思義就是在div上,再鋪一層半透明的div。在hover時(shí),亦可進(jìn)一步改變?cè)撜谡謱拥纳屎屯该鞫取N覀兛梢酝ㄟ^css定位和背景色實(shí)現(xiàn)。 CSS遮罩層實(shí)現(xiàn)及hover狀態(tài)丟失問題 ...
閱讀 3245·2021-11-15 11:37
閱讀 2460·2021-09-29 09:48
閱讀 3827·2021-09-22 15:55
閱讀 3023·2021-09-22 10:02
閱讀 2646·2021-08-25 09:40
閱讀 3238·2021-08-03 14:03
閱讀 1705·2019-08-29 13:11
閱讀 1579·2019-08-29 12:49