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 ...
随机推荐
- [1,2,3].forEach(alert);这样的写法有什么利和弊吗?
以下这个问题遇到了之后.问了太阳神,以下是太阳神的解答: [1,2,3].forEach(alert);这样的写法有什么利和弊吗? 首先forEach使用方法非常easy降低代码量, 可是也有非常多地 ...
- JS实现拖拽小案例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 无法解决 React 启动的报错
E:\React\react_blank>npm start > react_blank@0.1.0 start E:\React\react_blank > react-scrip ...
- sql server备份与还原 sql语句
USE master DECLARE tb CURSOR LOCAL FOR SELECT 'Kill '+ CAST(Spid AS VARCHAR) FROM master.dbo.sysproc ...
- 【例题 7-1 UVA - 725】Division
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 枚举分母从0到99999. 得到分子,判断合法 [代码] /* 1.Shoud it use long long ? 2.Have ...
- [Angular & Web] Retrieve user data from Session
Once user sign up, we store the user data inside cookie in the broswer and also keep a memory copy i ...
- 下拉列表,点击选择实现跳转链接 onchange="window.location=..."
<select onchange="window.location=this.value;"> <option value="a.html"& ...
- 软件——python,主函数
1;; 如何在spyder中运行python程序 如下图, 写入一个输出 ' hellow word '的程序 然后点击运行按钮就可以运行了.
- 使用mingw制作dll文件
使用mingw制作dll文件 安装mingw 准备math.c文件 //math.c #include<stdio.h> int add(int a,int b){ return a+b; ...
- 【】queue
[链接]点击打开链接 [题意] 实话实说,给 OIER 大神们排队这种工作是最让人头疼的事情了.因为同学们都有自尊 心,都不愿意排后面. 现在共有 n 个同学要排成一列,每个同学有两个属性:影响力和承 ...