当前位置:Gxlcms > JavaScript > javascript+HTML5自定义元素播放焦点图动画_javascript技巧

javascript+HTML5自定义元素播放焦点图动画_javascript技巧

时间:2021-07-01 10:21:17 帮助过:3人阅读

这是一款基于HTML5的焦点图动画,它和其他焦点图不同的地方在于,它播放的不仅仅是图片,而是可以自定义控制的网页元素。它不仅在图片间切换有过渡动画效果,而且在切换时图片中的元素也将出现动画效果,比如图中的文字移动、打散、重新组合等,这款HTML5动画图片播放器算得上是高端大气上档次。

效果图:

HTML代码

Kendo UI

SmartSite Ver 2.2
智能网站管理系统

采用前后台完全分离技术,通过标签(支持标签循环嵌套、判断标签、自定义标签、文件循环嵌套等)加模板技术.全站生成纯静态页。

Download Learn More

Kendo UI

企业网站管理系统

单页面、单页面索引、新闻、产品展示、下载、友情链接、网上商城,在线支付、配送、支付方式管理、广告等模块。

Download Learn More

Kendo UI

智能移动网站管理系统

基于jquery.Mobile、HTML5技术框架,前后台完全分离,采用标签加模板技术,全站生成纯静态页。

Download Learn More

? ?

CSS代码:

这里列出的是这个焦点图相关的核心CSS代码。

.slider section {display: none;}
.slider section.first {display: block;}

.slider-sections, .slider-sections section {width: 861px; height: 335px;}

.slider-sections {margin: 0 auto; position: relative;}
.slider-sections section {position: absolute; top: 0; left: 0px; }

.header-content h2 
{
 font:400 32px/1.2 "microsoft yahei", Tahoma, arial, sans-serif;
 color: #fff;
 margin: 0 0 26px;
}
.header-content p 
{
 margin: 0 0 30px;
}

.header-content .centered-content
{
 padding-top: 30px;
 padding-bottom: 10px;
}

.button {
 float: left;
 width: auto !important;
 list-style: none;
}
 .button a,
 .button button,
 .button input { /* Standard black button */
 font-size: 15px;
 /*font-family: 'lucida sans',arial,helvetica,sans-serif;*/
 line-height: 18px;
 color: #fff !important;

 text-decoration: none;

 padding: 5px 14px 6px 13px;
 display: block;
 width: auto;
 position: relative;
 z-index: 2;

  border: none;
  -moz-border-radius: 3px;
 border-radius: 3px;
 cursor: pointer;

 background: #313131; /* Old browsers */
 background: -moz-linear-gradient(top, #313131 0%, #222222 100%); /* FF3.6+ */
 background: -webkit-linear-gradient(top, #313131 0%,#222222 100%); /* Chrome10+,Safari5.1+ */
 background: -o-linear-gradient(top, #313131 0%,#222222 100%); /* Opera11.10+ */
 background: -ms-linear-gradient(top, #313131 0%,#222222 100%); /* IE10+ */
 background: linear-gradient(top, #313131 0%,#222222 100%); /* W3C */

 -webkit-transition: all 0.3s ease;
 -moz-transition: all 0.3s ease;
 -o-transition: all 0.3s ease;
 transition: all 0.3s ease;
 }

 .button a:hover,
 .button input:hover,
 .button button:hover,
 .button a:focus,
 .button input:focus,
 .button button:focus
 {
 background: #464646; /* Old browsers */
 background: -moz-linear-gradient(top, #464646 0%, #393939 100%); /* FF3.6+ */
 background: -webkit-linear-gradient(top, #464646 0%,#393939 100%); /* Chrome10+,Safari5.1+ */
 background: -o-linear-gradient(top, #464646 0%,#393939 100%); /* Opera11.10+ */
 background: -ms-linear-gradient(top, #464646 0%,#393939 100%); /* IE10+ */
 background: linear-gradient(top, #464646 0%,#393939 100%); /* W3C */
 }

 header .header-content .button a,
 #content .button a:hover
 {
  text-decoration: none;
 }

.header-content .beta-ribbons {
 position: absolute; 
 height: 120px;
 width: 85px;
 text-indent: -200px;
 overflow: hidden;
 background: url(../images/kendo-ribbons.png) no-repeat 0 0;
}

.header-content .beta-ribbons.ribbon-1 {
 background-position: -170px 0;
 top: -3px;
 right: -145px;
}

.header-content p.copy .beta-ribbons.ribbon-1 {
 top: -135px;
 left: 900px;
}

.header-content .beta-ribbons.ribbon-4 {
 background-position: -255px 0;
 left: -62px;
 top: -30px;
 z-index: 10;
 text-indent: -2000px;
}

JavaScript代码:

下面是这个焦点图插件的代码。

下面是页面调用的JS代码:

希望本文对大家学习javascript程序设计有所帮助。

人气教程排行