jQuery实现手风琴小案例_第1页
jQuery实现手风琴小案例_第2页
jQuery实现手风琴小案例_第3页
jQuery实现手风琴小案例_第4页
jQuery实现手风琴小案例_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

第jQuery实现手风琴小案例本文实例为大家分享了jQuery实现手风琴的具体代码,供大家参考,具体内容如下

代码演示效果:

1.运用jQuery,动画样式进行轮播图切换

2.前提,需要引入animate.css(官网下载就有)

HTML代码:

head

metacharset="UTF-8"

title手风琴/title

linkrel="stylesheet"href="../animate.css"

linkrel="stylesheet"href="css/index.css"

scriptsrc="../jquery-3.1.0.js"/script

!--scriptsrc="js/手风琴index.js"/script--

/head

body

div/div

div/div

div/div

div/div

div

lidivp穿越火线/p/div/li

lidivp王者荣耀/p/div/li

lidivp使命召唤/p/div/li

lidivp英雄联盟/p/div/li

/ul

/div

/body

script代码:

script

$(function(){

$("li").mouseenter(function(){

//stop()阻止动画效果

$(this).stop().animate({width:"700px"},1000,"linear").fadeIn();

$(this).siblings("li").stop().animate({width:"100px"},1000,"linear").fadeIn();

$(".bg").eq($(this).index()).siblings(".bg").stop().fadeOut();

$(".bg").eq($(this).index()).stop().animate({top:"700px"},400,"linear").fadeIn();

});

/script

css代码:

margin:0;

padding:0;

html,body,.bg{

height:700px;

width:1400px;

overflow:hidden;

body{

position:relative;

display:none;

.bg:nth-child(1){

background:url("../images/1.jpg")no-repeatcenter/cover;

.bg:nth-child(2){

background:url("../images/2.jpg")no-repeatcenter/cover;

.bg:nth-child(3){

background:url("../images/3.jpg")no-repeatcenter/cover;

.bg:nth-child(4){

background:url("../images/4.jpg")no-repeatcenter/cover;

/*大背景显示*/

.bg-active{

display:block;

.main{

position:absolute;

width:1000px;

height:400px;

/*background-color:pink;*/

left:0;

top:0;

right:0;

bottom:0;

margin:auto;

.mainul{

list-style:none;

.mainulli{

float:left;

width:100px;

height:400px;

transition:right1s;

/*小背景显示*/

.mainulli.li-active{

width:700px;

height:400px;

.mainulli:nth-child(1){

background:url("../images/1.jpg")no-repeatcenter/cover;

.mainulli:nth-child(2){

background:url("../images/2.jpg")no-repeatcenter/cover;

.mainulli:nth-child(3){

background:url("../images/3.jpg")no-repeatcenter/cover;

.mainulli:nth-child(4){

background:url("../images/4.jpg")no-repeatcenter/cover;

.mainullidiv{

height:400px;

width:100px;

background-color:rgba(0,0,0,.5);

.main

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论