摘要:
-------------------------------tipswindown.js------------------------------
///-------------------------------------------------------------------------
//jQuery弹出窗口 By Await [2009-11-22]
//--------------------------------------------------------------------------
/*参数:[可选参数在调用时可写可不写,其他为必写]
----------------------------------------------------------------------------
title: 窗口标题
content: 内容(可选内容为){ text | id | img | url | iframe }
width: 内容宽度
height: 内容高度
drag: 是否可以拖动(ture为是,false为否)
time: 自动关闭等待的时间,为空是则不自动关闭
showbg: [可选参数]设置是否显示遮罩层(0为不显示,1为显示)
cssName: [可选参数]附加class名称
------------------------------------------------------------------------*/
//示例:
//------------------------------------------------------------------------
//simpleWindown("例子","text:例子","500","400","true","3000","0","exa")
//------------------------------------------------------------------------
var showWindown = true;
var templateSrc = "http://www.7daysinn.cn"; //设置loading.gif路径
function tipsWindown(title,content,width,height,drag,time,showbg,cssName,backcall) {
$("#windown-box").remove(); //请除内容
var width = width>= 950?this.width=950:this.width=width; //设置最大窗口宽度
var height = height>= 527?this.height=527:this.height=height; //设置最大窗口高度
if(showWindown == true) {
var simpleWindown_html = new String;
simpleWindown_html = "";
simpleWindown_html += "";
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("加载数据出错...
");
},
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("加载数据出错...
");
},
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("加载数据出错...
");
},
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");//设置透明度
$("#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----------------------------------
- .mainlist{padding:10px;}
- .mainlist div {margin:0 5px 0 0;font-family:"宋体";font-size:12px;font-weight:400;color:#ffffd;}
- .btnbox{text-align:center;height:30px;padding-top:10px;background:#ECF9FF;}
- #windownbg{display:none;position:absolute;width:100%;height:100%;background:#000;top:0;left:0;}
- #windown-box{position:fixed;_position:absolute;border:5px solid #E9F3FD;background:#FFF;text-align:left;}
- #windown-title{position:relative;height:30px;border:1px solid #A6C9E1;overflow:hidden;background:url(/images/tipbg.png) 0 0 repeat-x;}
- #windown-title h2{position:relative;left:10px;top:5px;font-size:14px;color:#666;}
- #windown-close{position:absolute;right:10px;top:8px;width:10px;height:16px;text-indent:-10em;overflow:hidden;background:url(/images/tipbg.png) 100% -49px no-repeat;cursor:pointer;}
- #windown-content-border{position:relative;top:-1px;border:1px solid #A6C9E1;padding:5px 0 5px 5px;}
- #windown-content img,#windown-content iframe{display:block;}
- #windown-content .loading{position:absolute;left:50%;top:50%;margin-left:-8px;margin-top:-8px;}
---------------------------------html------------------------------
- /*
- *弹出本页指定ID的内容于窗口
- *id 指定的元素的id
- *title: window弹出窗的标题
- *width: 窗口的宽,height:窗口的高
- */
- function showTipsWindown(title, id, width, height) {
- tipsWindown(title, "id:" + id, width, height, "true", "", "true", id);
- }
- function confirmTerm(s) {
- parent.closeWindown();
- if (s == 1) {
- parent.document.getElementById("isread").checked = true;
- }
- }
- //弹出层调用
- function popTips() {
- showTipsWindown("jQuery弹出层", "simTestContent", 600, 255);
- $("#isread").attr("checked", false);
- }
?javascript弹出层插件可自定义js弹出层动画特效
?jquery弹出层鼠标点击弹出层可浮动在屏幕滚动
?jquery弹出层特效animate制作类似flash动画效果弹出层
?jquery 弹出层 点击按钮弹出层兼容IE和firefox浏览器
?jquery 弹出层插件 鼠标点击文字获取标题弹出层内容信息
?jquery 弹出层插件 ThickBox 多功能弹出层插件支持图片、ajax、内嵌内容弹等
?jquery 弹出层插件FancyBox弹出层演示支持图片、文章内容、flash swf弹出层等
?jquery弹出层鼠标点击弹出层可浮动在屏幕滚动
?jquery弹出层特效animate制作类似flash动画效果弹出层
?jquery 弹出层 点击按钮弹出层兼容IE和firefox浏览器
?jquery 弹出层插件 鼠标点击文字获取标题弹出层内容信息
?jquery 弹出层插件 ThickBox 多功能弹出层插件支持图片、ajax、内嵌内容弹等
?jquery 弹出层插件FancyBox弹出层演示支持图片、文章内容、flash swf弹出层等
?javascript弹出层插件可自定义js弹出层动画特效
?jquery弹出层鼠标点击弹出层可浮动在屏幕滚动
?jquery弹出层特效animate制作类似flash动画效果弹出层
?jquery 弹出层 点击按钮弹出层兼容IE和firefox浏览器
?jquery 弹出层插件 鼠标点击文字获取标题弹出层内容信息
?jquery 弹出层插件 ThickBox 多功能弹出层插件支持图片、ajax、内嵌内容弹等
?jquery 弹出层插件FancyBox弹出层演示支持图片、文章内容、flash swf弹出层等
?jquery弹出层鼠标点击弹出层可浮动在屏幕滚动
?jquery弹出层特效animate制作类似flash动画效果弹出层
?jquery 弹出层 点击按钮弹出层兼容IE和firefox浏览器
?jquery 弹出层插件 鼠标点击文字获取标题弹出层内容信息
?jquery 弹出层插件 ThickBox 多功能弹出层插件支持图片、ajax、内嵌内容弹等
?jquery 弹出层插件FancyBox弹出层演示支持图片、文章内容、flash swf弹出层等
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/111346.html
摘要:在这个系列里分享一些简单,但是很有意思的交互效果附上地址和地址滚动,添加对应加载的比如巧用实现文字和遮罩层的动画效果文字动画遮罩层动画首先然后把且,这样就实现了遮罩层的进场和退出效果随机获取数组项 在这个系列里分享一些简单,但是很有意思的交互效果~附上demo地址和github地址 showImg(https://makapicture.oss-cn-beijing.aliyuncs....
摘要:在这个系列里分享一些简单,但是很有意思的交互效果附上地址和地址滚动,添加对应加载的比如巧用实现文字和遮罩层的动画效果文字动画遮罩层动画首先然后把且,这样就实现了遮罩层的进场和退出效果随机获取数组项 在这个系列里分享一些简单,但是很有意思的交互效果~附上demo地址和github地址 showImg(https://makapicture.oss-cn-beijing.aliyuncs....
摘要:背景官网有个对话框组件如图如果哪天不能用框架了不能用组件了只能用原生写页面现在的我可能要一个页面写一年目标用原生完成这个页面弹框处于垂直居中状态且点击弹框外任意区域关闭弹框写了很久很久时间就不说了遇到的最难的问题就是不知道怎么关闭弹框后面还 背景:Ant官网有个对话框Model组件.如图: showImg(https://segmentfault.com/img/bVbwMCG?w=1...
摘要:背景官网有个对话框组件如图如果哪天不能用框架了不能用组件了只能用原生写页面现在的我可能要一个页面写一年目标用原生完成这个页面弹框处于垂直居中状态且点击弹框外任意区域关闭弹框写了很久很久时间就不说了遇到的最难的问题就是不知道怎么关闭弹框后面还 背景:Ant官网有个对话框Model组件.如图: showImg(https://segmentfault.com/img/bVbwMCG?w=1...
摘要:在时,亦可进一步改变该遮罩层的色彩和透明度。遮罩层实现及状态丢失问题代码代码在时,如果快速点击鼠标,可能会丢失的效果。状态丢失的简单解决方案基本思路是,点击鼠标时给添加,强制它显示里的样式。 CSS遮罩层,顾名思义就是在div上,再铺一层半透明的div。在hover时,亦可进一步改变该遮罩层的色彩和透明度。我们可以通过css定位和背景色实现。 CSS遮罩层实现及hover状态丢失问题 ...
摘要:在时,亦可进一步改变该遮罩层的色彩和透明度。遮罩层实现及状态丢失问题代码代码在时,如果快速点击鼠标,可能会丢失的效果。状态丢失的简单解决方案基本思路是,点击鼠标时给添加,强制它显示里的样式。 CSS遮罩层,顾名思义就是在div上,再铺一层半透明的div。在hover时,亦可进一步改变该遮罩层的色彩和透明度。我们可以通过css定位和背景色实现。 CSS遮罩层实现及hover状态丢失问题 ...
阅读 3415·2021-11-15 11:37
阅读 2560·2021-09-29 09:48
阅读 4231·2021-09-22 15:55
阅读 3088·2021-09-22 10:02
阅读 2718·2021-08-25 09:40
阅读 3326·2021-08-03 14:03
阅读 1778·2019-08-29 13:11
阅读 1652·2019-08-29 12:49