龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > Javascript编程 >

jQuery s3Slider插件实现产品效果炫丽,非常不错(2)

时间:2009-12-21 11:47来源:未知 作者:admin 点击:
分享到:
套用 s3Slider 效果的元素 ID 为会被当作内含元素其 id 或 class 的前置字符串;例如 div#s3slider ,里面的 ul 和 li 其 id 及 class 名称就要以 s3slider 开头,然后要

套用 s3Slider 效果的元素 ID 为会被当作内含元素其 id 或 class 的前置字符串;例如 div#s3slider ,里面的 ul 和 li 其 id 及 class 名称就要以 s3slider 开头,然后要再加上 Content 和 Image 等关键词。
接下来是 CSS 的部份,你可以调整成你喜欢的格式:
Code
s3slider {
   width: 400px; /* important to be same as image width */
   height: 300px; /* important to be same as image height */
   position: relative; /* important */
   overflow: hidden; /* important */
}
 
#s3sliderContent {
   width: 400px; /* important to be same as image width or wider */
   position: absolute; /* important */
   top: 0; /* important */
   margin-left: 0; /* important */
}
 
.s3sliderImage {
   float: left; /* important */
   position: relative; /* important */
   display: none; /* important */
}
 
.s3sliderImage span {
   position: absolute; /* important */
   left: 0;
   font: 10px/15px Arial, Helvetica, sans-serif;
   padding: 10px 13px;
   width: 374px;
   background-color: #000;
   filter: alpha(opacity=70); /* here you can set the opacity of box with text */
   -moz-opacity: 0.7; /* here you can set the opacity of box with text */
   -khtml-opacity: 0.7; /* here you can set the opacity of box with text */
   opacity: 0.7; /* here you can set the opacity of box with text */
   color: #fff;
   display: none; /* important */
   top: 0;
 
   /*
          if you put
          top: 0;  -> the box with text will be shown at the top of the image
          if you put
          bottom: 0;  -> the box with text will be shown at the bottom of the image
   */
}
 
.clear {
   clear: both;
}
最后,你只需要在 div#s3Slider 上套用 s3Slider Plugin 即可:

Code
$(document).ready(function() {
    $('#s3slider').s3Slider({
        timeOut: 4000
    });
});

效果就如同上面展示页所呈现的,是不是很简单呢?

结论

在讲求开发容易又要视觉效果一流的制作 Web 方法中,使用 jQuery 似乎已经是多数人所认同的最佳解决方案。而 s3Slider 更是利用了 jQuery 强大的延展性,为我们在 Web 产品展示上加了不少分数。而且 s3Slider 只需要简单的 HTML 结构,更让程序开发人员在套用程序代码上省事不少。因此我推荐这个 Plugin 给大家,希望大家能想出更多有趣的应用。

 


精彩图集

赞助商链接