jquery实例1:淡入淡出窗口

news/2024/7/10 22:42:24 标签: jquery, stylesheet, javascript, html, css, function
htmledit_views">

 

1.html代码:

window.html源代码:

Html代码 复制代码
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">   
  2. < html >   
  3.     < head >   
  4.         < title > html" title=jquery>jquery实例1:深入浅出窗口</ title >   
  5.   
  6.         < meta  http-equiv ="content-type"  content ="text/html; charset=UTF-8" >   
  7.         < script  type ="text/html" title=javascript>javascript"  src ="js/html" title=jquery>jquery-1.3.2.js" > </ script >   
  8.         < script  type ="text/html" title=javascript>javascript"  src ="js/html" title=jquery>jquerywin.js" > </ script >   
  9.         < link  href ="css/win.css"  rel ="html" title=stylesheet>stylesheet"  type ="text/css"  />   
  10.   
  11.     </ head >   
  12.   
  13.     < body >   
  14.         < a  onclick ="showwin()"  href ="#" > 显示浮动窗口</ a >   
  15.         < div  id ="win" >   
  16.             < div  id ="title" >   
  17.                 我是标题栏!!   
  18.                 < span  id ="close"  onclick ="hide()" > X</ span >   
  19.             </ div >   
  20.             < div  id ="content" >   
  21.                 我是一个窗口哦!!   
  22.             </ div >   
  23.         </ div >   
  24.     </ body >   
  25. </ html >   
html"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>html" title=jquery>jquery实例1:深入浅出窗口</title>

		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<script type="text/html" title=javascript>javascript" src="js/html" title=jquery>jquery-1.3.2.js"></script>
		<script type="text/html" title=javascript>javascript" src="js/html" title=jquery>jquerywin.js"></script>
		<link href="css/win.css" rel="html" title=stylesheet>stylesheet" type="text/css" />

	</head>

	<body>
		<a οnclick="showwin()" href="#">显示浮动窗口</a>
		<div id="win">
			<div id="title">
				我是标题栏!!
				<span id="close" οnclick="hide()">X</span>
			</div>
			<div id="content">
				我是一个窗口哦!!
			</div>
		</div>
	</body>
</html>

 

 

2.html" title=javascript>javascript代码:

html" title=jquery>jquerywin.js源代码:

Js代码 复制代码
  1. function  showwin() {   
  2.   
  3.     //使用纯html" title=javascript>javascript来控制css   
  4.     //var winNode = document.getElementById("win");   
  5.     //winNode.style.display = "block";   
  6.        
  7.     //方法1,修改节点的css值,让窗口显示出来   
  8.     //$("#win").css("display", "block");   
  9.     //方法2,利用Jquery的show方法   
  10.     //$("#win").show("normal");   
  11.     //方法3,利用Jquery的fadeIn方法   
  12.     $("#win" ).fadeIn("slow" );   
  13. }   
  14.   
  15. function  hide() {   
  16.     //将窗口隐藏起来   
  17.     //注意,这里的隐藏方法与前面的显示方法需要一一对应,   
  18.     //比如你使用方法一显示窗口,那么也要使用方法一进行隐藏   
  19.     //方法1,修改css   
  20.     //$("#win").css("display", "none");   
  21.     //方法2,利用hide方法   
  22.     //$("#win").hide("slow");   
  23.     //方法3,利用fadeOut方法   
  24.     $("#win" ).fadeOut("slow" );   
  25. }  

 

 

3.css代码:

win.css源代码:

Html代码 复制代码
  1. /*id选择器*/   
  2. #win {   
  3.     /*希望窗口有边框*/   
  4.     border: 1px red solid;   
  5.     width: 300px;   
  6.     height: 250px;   
  7.     position: absolute;   
  8.     top: 100px;   
  9.     left: 200px;   
  10.     /*希望窗口开始时不可见*/   
  11.     display: none;   
  12. }   
  13.   
  14. /*控制标题栏的样式*/   
  15. #title {   
  16.     /*背景色*/   
  17.     background-color: blue;   
  18.     /*文字颜色*/   
  19.     color: yellow;   
  20.     /*左内边距*/   
  21.     padding-left: 3px;   
  22. }   
  23.   
  24. /*控制内容区域的样式*/   
  25. #content {   
  26.     padding-top: 30px;   
  27.     padding-left: 5px;   
  28. }   
  29.   
  30. /*控制关闭按钮的位置*/   
  31. #close {   
  32.     /*使关闭按钮向右侧移动*/   
  33.     margin-left: 155px;   
  34.     /*让鼠标进入时可以显示小手,告知用户可以点击操作*/   
  35.     cursor: pointer;   
  36. }  
html">/*id选择器*/
#win {
	/*希望窗口有边框*/
	border: 1px red solid;
	width: 300px;
	height: 250px;
	position: absolute;
	top: 100px;
	left: 200px;
	/*希望窗口开始时不可见*/
	display: none;
}

/*控制标题栏的样式*/
#title {
	/*背景色*/
	background-color: blue;
	/*文字颜色*/
	color: yellow;
	/*左内边距*/
	padding-left: 3px;
}

/*控制内容区域的样式*/
#content {
	padding-top: 30px;
	padding-left: 5px;
}

/*控制关闭按钮的位置*/
#close {
	/*使关闭按钮向右侧移动*/
	margin-left: 155px;
	/*让鼠标进入时可以显示小手,告知用户可以点击操作*/
	cursor: pointer;
}

 

 

ok,所有代码已经完毕,现在看一下效果图吧。

 


http://www.niftyadmin.cn/n/1050521.html

相关文章

jquery重新设置超链接

最近做项目需要做到一个项目&#xff0c;其中有一个可行方案&#xff1a; 由于分页的超链接是公司标签封装的&#xff0c;不能直接修改&#xff0c;通过查看编译后在客户端的网页&#xff0c;想到了利用JQUERY框架的 功能来替换某部分原来的url(实际上是在url里加入新的字…

拓扑排序+数学+DP【p1685】游览

Description 顺利通过了黄药师的考验&#xff0c;下面就可以尽情游览桃花岛了&#xff01; 你要从桃花岛的西头开始一直玩到东头&#xff0c;然后在东头的码头离开。可是当你游玩了一次后&#xff0c;发现桃花岛的景色实在是非常的美丽&#xff01;&#xff01;&#xff01;于是…

水晶报表循环记录显示为表格的形式

报表中插入组&#xff0c;组的内容即要循环显示的内容&#xff0c;手动画上线&#xff0c;重复出来即可显示为表格转载于:https://www.cnblogs.com/yubufan/p/9339239.html

博弈论在零售业务中的应用

在零售业的供应链管理中, 我们经常会遇到一些资源分配问题, 例如商品的供需平衡, 销售利润分摊, 运输成本分摊等. 常见的分配方式有平均分和按权重(比例)分. 在某些应用场景下, 我们需要体现分配方案的"公平性", 那么如何科学地定义公平性, 又如何计算公平的分配方案…

JPA中的集合查询示例

&#xff11;、VisitInfo模型 view plaincopy to clipboardprint? Entity Table(name System_VisitInfo) Cache(usageCacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class VisitInfo implements Serializable { private static final long serialVersionUID 287 &…

windows下简单验证码识别——完美验证码识别系统

此文已由作者徐迪授权网易云社区发布。欢迎访问网易云社区&#xff0c;了解更多网易技术产品运营经验。讲到验证码识别&#xff0c;大家第一个可能想到tesseract。诚然&#xff0c;对于OCR而言&#xff0c;tesseract确实很强大&#xff0c;自带的字模能识别绝大多数规整的中英文…

C#根据byte前两位获取图片扩展名

C#根据byte前两位获取图片扩展名 /// <summary>/// 根据byte前两位获取图片扩展名/// </summary>/// <param name"bytes01"></param>/// <returns></returns>public static string GetImageExtensionName(string bytes01){strin…

电商业务中的纸箱推荐问题

背景 在电商业务中, 一个核心的生产环节是打包: 把用户购买的商品打包装入纸箱. 纸箱成本一般与纸板面积成正比. 为了节约打包成本, 我们希望从候选纸箱中选择最小的纸箱来装用户购买的商品. 在实际操作中, 工人一般倾向于选择较大的纸箱, 不仅能减少选择纸箱的时间, 而且能降…