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 ...
随机推荐
- 怎样将OpenStack部署到Hadoop
随着信息时代的快速发展,大数据技术和私有云环境都非常实用;只是,假设将两者结合在一起.企业会获得巨大的利润.虽然结合两者会让环境变得更复杂.企业仍然能够看到将 OpenStack 私有云和 Apach ...
- 报错 关于python的x和y不等长
ValueError: shape mismatch: objects cannot be broadcast to a single shape 这个错误可能是因为传入的两个参数数据长度不一样,比如 ...
- 初学者路径规划 | 人生苦短我用Python
纵观编程趋势 人生苦短,我用Python,比起C语言.C#.C++和JAVA这些编程语言相对容易很多.Python非常适合用来入门.有人预言,Python会成为继C++和Java之后的第三个主流编程语 ...
- 【2017中国大学生程序设计竞赛 - 网络选拔赛 && hdu 6154】CaoHaha's staff
[链接]点击打开链接 [题意] 给你一个面积,让你求围成这个面积最少需要几条边,其中边的连线只能是在坐标轴上边长为1的的线或者是两个边长为1 的线的对角线. [题解] 找规律题 考虑s[i]表示i条边 ...
- Jpa 的Persistence.xml配置讲解
<?xml version="1.0"?> <persistence xmlns="http://java.sun.com/xml/ns/persist ...
- 基于ContentObserver来动态取消或加入屏幕超时任务
前面也说了.ContentObserver能够来监控数据库里某一项数据的变化,当然也能够同一时候监控多个数据项的变化. 笔者在项目中须要改动到屏幕超时的需求,比方在车载业务中,倒车事件发生的时候,是不 ...
- JIRA6.3.6 安装汉化破解指南
JIRA6.3.6 安装汉化破解指南 近期试着安装了下JIRA,碰到了些问题.特记录下来,供后来者使用: 1.常规安装 1.1. 下载并安装jira 从官网下载atlassian-jira-6.3.6 ...
- Oracle Web链接客户端
TreeSoft数据库管理系统 http://www.treesoft.cn
- 自定义 matplotlib 设置
Customizing plots with style sheets import matplotlib as mpl 查看配置文件所在的目录:mpl.get_configdir() 1. 自定义 ...
- 【例题3-4 UVA - 340】Master-Mind Hints
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 这里出现了没有在相同位置的只能唯一配对. 就是说 3322 2234 这种情况. 只有3个weak pair. 即key[1]=a[ ...