jquery-1 jquery几个小实例
jquery-1 jquery几个小实例
一、总结
一句话总结:jquery真的是简单加简便。
1、jquery中改变多个css属性怎么整?
可以链式连接方式,也可以大括号整多个。中间是键值对加引号的形式,和在css中写很像。css中写左边没有引号。右边也没有引号
64 function(){
65 $(this).animate({
66 'margin-left':'0px'
67 },500);
68 }
二、jquery几个小实例
toggle循环单击
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
<style>
*{
font-family: 微软雅黑;
}
</style>
<script src="jquery.js"></script>
</head>
<body>
<img src="a.png" alt="">
</body>
<script>
$('img').toggle(
function(){
this.src='b.png';
},
function(){
this.src='a.png';
}
);
</script>
</html>
hover鼠标循环移入移出
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
<style>
*{
font-family: 微软雅黑;
}
</style>
<script src="jquery.js"></script>
</head>
<body>
<img src="a.png" alt="">
</body>
<script>
$('img').hover(
function(){
this.src='b.png';
},
function(){
this.src='a.png';
}
);
</script>
</html>
酒仙网左滑右滑特效
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
<style>
*{
font-family: 微软雅黑;
} .jiu{
width:180px;
overflow: hidden;
float: left;
margin-left:35px;
margin-top:15px;
} </style>
<script src="jquery.js"></script>
</head>
<body>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
<div class='jiu'>
<img src="jiu.jpg" alt="">
</div>
</body>
<script>
$('img').hover(
function(){
$(this).animate({
'margin-left':'-100px'
},500);
},
function(){
$(this).animate({
'margin-left':'0px'
},500);
}
);
</script>
</html>
单击标题切换内容
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
<style>
*{
font-family: 微软雅黑;
} </style>
<script src="jquery.js"></script>
</head>
<body>
<h1>linux</h1>
<p>linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!</p> <h1>linux</h1>
<p>linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!</p> <h1>linux</h1>
<p>linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!</p> <h1>linux</h1>
<p>linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!linux is very much!</p>
</body>
<script>
$('h1').click(function(){
$(this).next().toggle(1000);
});
</script>
</html>
水果复制选择
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
<style>
*{
font-family: 微软雅黑;
} select{
width:100px;
height:150px;
}
</style>
<script src="jquery.js"></script>
</head>
<body>
<h1>水果选择:</h1>
<form action="javascript:">
<select name="" id="s1" size='2'>
<option value="">西瓜</option>
<option value="">冬瓜</option>
<option value="">苹果</option>
<option value="">南瓜</option>
</select> <input type="button" value=">>" id='btn'> <select name="" id="s2" size='2'>
</select>
</form>
</body>
<script>
$('#btn').click(function(){
$('#s1 option:selected').clone().appendTo('#s2');
});
</script>
</html>
水果移动选择
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
<style>
*{
font-family: 微软雅黑;
} select{
width:100px;
height:150px;
}
</style>
<script src="jquery.js"></script>
</head>
<body>
<h1>水果选择:</h1>
<form action="javascript:">
<select name="" id="s1" size='2'>
<option value="">西瓜</option>
<option value="">冬瓜</option>
<option value="">苹果</option>
<option value="">南瓜</option>
</select> <input type="button" value=">>" id='btn'> <select name="" id="s2" size='2'>
</select>
</form>
</body>
<script>
$('#btn').click(function(){
$('#s1 option:selected').appendTo('#s2');
});
</script>
</html>
jquery-1 jquery几个小实例的更多相关文章
- angularjs jquery thinkPHP3.2.3 相结合小实例
angular1.5 与 jquery想结合一个小应用 index.html <html> <head> <meta charset="utf-8"& ...
- 【jQuery小实例】---2自定义动画
---本系列文章所用使用js均可在本博客文件中找到 本节用jQuery完一个简易的动画效果,一个小驴跑跑的效果.和一个类似qq面板效果.大致也分为三步:添加jquery-1.8.3.js文件.这个是不 ...
- JavaScript、jQuery、HTML5、Node.js实例大全-读书笔记3
技术很多,例子很多,只好慢慢学,慢慢实践!!现在学的这本书是[JavaScript实战----JavaScript.jQuery.HTML5.Node.js实例大全] JavaScript.jQuer ...
- jQuery.uploadify文件上传组件实例讲解
1.jquery.uploadify简介 在ASP.NET中上传的控件有很多,比如.NET自带的FileUpload,以及SWFUpload,Uploadify等等,尤其后面两个控件的用户体验比较好, ...
- JQuery数组详解(含实例)
<!doctype html>jQuery数组处理详解(含实例演示)@Mr.Think 演示所用数组 var _mozi=['墨家','墨子','墨翟','兼爱非攻','尚同尚贤']; 1 ...
- jQuery File Upload 单页面多实例的实现
jQuery File Upload 的 GitHub 地址:https://github.com/blueimp/jQuery-File-Upload 插件描述:jQuery File Upload ...
- jQuery FileUpload等插件的使用实例
1.jQuery FileUpload 需要的js: jquery.js jquery.fileupload.js jquery.iframe-transport.js jquery.xdr-tran ...
- jquery弹出关闭遮罩层实例
jquery弹出关闭遮罩层实例. 代码如下: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" & ...
- JavaScript、jQuery、HTML5、Node.js实例大全-读书笔记2
技术很多,例子很多,只好慢慢学,慢慢实践!!现在学的这本书是[JavaScript实战----JavaScript.jQuery.HTML5.Node.js实例大全] JavaScript.jQuer ...
随机推荐
- ArcEngine的ToolbarControl解析
转自Love Lyre原文 ArcEngine的ToolbarControl解析 ToolbarControlClass有三个主要的接口: IToolbarControl, IToolbarContr ...
- Spring MVC框架实例
Spring MVC 背景介绍 Spring 框架提供了构建 Web 应用程序的全功能 MVC 模块.使用 Spring 可插入的 MVC 架构,能够选择是使用内置的 Spring Web 框架还是 ...
- 使用差分VHD启动Win7
平台:windows 8.1 目的:在VHD里装个Win7 介绍:建立VHD装系统姑且不表,比较有意思的是用差分VHD备份系统这点. 差分硬盘这个概念在虚拟机里常用,类似VM中的快照,不过差分硬盘更灵 ...
- 硬件——STM32,ADC篇
未完,待续...... 也就是stm32f10X系列的adc采集出来的结果是12位的 stm32f10X系列有两个16位adc 关于程序的编写方法:一般 “某某.c文件”:都是用来设置“某某”的一些 ...
- Node知识总结
一. 伪装URL-SEO 伪URL重写 把一个动态页面的地址重写为静态页面的地址,为了方便网站的SEO优化 真实地址:http://item.jd.com/detail.php?id=12261336 ...
- Php无限层级并显示层级数
今天在处理递归无限层级菜单时,遇到一个稍微烧脑的问题,如何显示当前节点所在的层级数.废话不多说,我们先看个直观的无限层级: <?php // 这里的arr是直接从数据库取出的,仅作为测试数据 $ ...
- 【UVA】434-Matty's Blocks
一道非常easy想复杂的题,给出主视图和右视图,计算最少能用几个正方体组成相应的视图,以及最多还能加几块正方体. 求最多加入事实上就是求出最多的正方体数减去最少的,主要就是最少的不好求. 一開始各种模 ...
- python的list和数组的区别
list不是数组(额外安装Pynum) 1)可修改,list数据结构内容可以被程序修改 2)可动态增减,长度不固定 3)list里面的数据项可以是不同类型数据,也可以是list 4)两个list可“链 ...
- ASP.NET配置文件里经常使用到的节点信息
web.config文件是一个XML文件,是以<confirguration>为根结点展开的. 上一面从宏观上解说了一下有关配置的文件的内容,以下是一些有关于配置文件经常使用的操作. ...
- swift开发网络篇—利用NSURLSession 发送GET和POST请求
说明:本文示例代码发送的请求均为http请求,需要对info.plist文件进行配置.如何配置,请参考https://github.com/HanGangAndHanMeimei/iOS9Adapta ...