微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

JavaScript手风琴页面制作

啥都不说了,直接上效果

1.Html结构代码

rush:xhtml;"> 手风琴2

2.css样式代码

rush:css;"> *{ padding: 0px; margin: 0px; font-family: "微软雅黑"; }

gs {

width: 1100px;
height: 429px;

}

.gs {
width: 100px;
height: 429px;
float: left;
}

.gs4 {
width: 789px;
height: 429px;
}

.gs1 {
background: url(../img/img/1.jpg) repeat scroll top left;
}
.gs2 {
background-image: url(../img/img/2.jpg);
}
.gs3 {
background-image: url(../img/img/3.jpg);
}
.gs4 {
background-image: url(../img/img/4.jpg);
}

.txt {
width: 100px;
height: 429px;
/margin: 15px;/
background: rgba(0,0.5);
cursor: pointer;
}

/.txt p {
float: left;
width: 20px;
height: 429px;
color: #fff;
font-size: 20px;
margin: 14px;
}
/

.txt p {
color: #fff;
float: left;
margin: 15px;
}

.txt .p1 {
font-size: 14px;
width: 14px;
}

.txt .p2 {
font-size: 12px;
width: 12px;
}

3.javascript代码

rush:js;"> $(function(){ $(".txt").mouSEOver(function(){ $(this).parent().stop(true).animate({"width":"789px"},500).siblings().stop(true).animate({"width":"100px"},500); }); });

4.主要:

a.字体竖排垂直:字体大小font-size = 包含字体标签宽度width

b.js中stop()方法:stop()表示结束动画有过渡

         stop(true)表示暂停动画,

         stop(true,true)表示立即结束动画,无过渡

c.parent():找到上一级元素

siblings():除了本元素外,其他的。。。

animate():动画效果

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程之家。

原文地址:https://www.jb51.cc/js/39268.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

js手风琴

相关推荐