fullPage.js制作网易邮箱大师页面

分类:代码 日期:

fullPage.js制作网易邮箱大师页面

演 示 下 载

注意:本示例中使用了已经淘汰的 flash 技术,浏览器已不再支持,示例无法正常运行,请勿下载。

简介

网易邮箱是国内著名的邮箱,多年的发展累积了大量用户,拥有不错的口碑。2014 年早期,网易邮箱推出了 6.0 版本,更加高大上,小D 也用 fullPage.js 制作了它的介绍页面(点击查看)。近期网易又推出了移动版邮箱客户端——邮箱大师(查看),介绍页面虽然和 6.0 的类似,但还是有较大的不同:邮箱大师使用了 flash,并且滚动后 flash 会重新播放,比较特别。今天小D 就再用 fullPage.js 来制作这个页面吧。

注意:本例无法在本地预览,需要上传到服务器才能预览。

浏览器兼容

IE Chrome Firefox Opera Safari
IE6+ ✔ Chrome ✔ Firefox ✔ Opera ✔ Safari ✔

制作方法

1、引入文件

<link rel="stylesheet" href="css/jquery.fullPage.css">
<script src="js/jquery.min.js"></script>
<script src="js/swfobject.min.js"></script>
<script src="js/jquery.easing.js"></script>
<script src="js/jquery.fullPage.min.js"></script>

除了必须的文件外,我们还使用了 swfobject,这个插件用于处理 flash。

2、HTML

<div id="dowebok-Wrap">
    <div class="section">
        <div id="cnt1">123</div>
    </div>
    <div class="section">
        <div id="cnt2">abc</div>
    </div>
    <div class="section">
        <div id="cnt3"></div>
    </div>
    <div class="section">
        <div id="cnt4"></div>
    </div>
    <div class="section">
        <div id="cnt5"></div>
    </div>
    <div class="section section6">
    </div>
</div>

HTML 和以前一样,这里 div#cnt(*) 元素是空的,需要 SEO 的话,可以填入文本内容,这些内容会被 swfobject 处理变成 flash。

3、JavaScript

3.1、把 div#cnt(*) 替换成 flash:

var l = "i10/swf/1.swf?t=" + new Date().getTime(),
    j = "i10/swf/2.swf?t=" + new Date().getTime(),
    h = "i10/swf/3.swf?t=" + new Date().getTime(),
    g = "i10/swf/4.swf?t=" + new Date().getTime(),
    d = "i10/swf/5.swf?t=" + new Date().getTime();
var e = 1;
var f = {};
var i = {
    wmode: "opaque"
};
var b = "100%",
    q = "100%",
    n = "9.0.0",
    p = "i10/swf/expressInstall.swf";
var k = {};
swfobject.embedSWF(l, "cnt1", b, q, n, p, f, i, k, function(a) {});
swfobject.embedSWF(j, "cnt2", b, q, n, p, f, i, k, function() {});
swfobject.embedSWF(h, "cnt3", b, q, n, p, f, i, k, function() {});
swfobject.embedSWF(g, "cnt4", b, q, n, p, f, i, k, function() {});
swfobject.embedSWF(d, "cnt5", b, q, n, p, f, i, k, function() {});

3.2、使用 fullPage.js 处理页面,并在 onLeave 和 afterLoad 方法里给相应的对象加上 ntfocus() 和 ntunfocus() 方法,使页面滚动时 flash 可以重新播放:

$("#dowebok-Wrap").fullpage({
    verticalCentered: false,
    navigation: true,
    navigationTooltips: ["1", "2", "3", "4", "5", "6"],
    afterLoad: function(anchorLink, index){
        if(index != 6){
            swfobject.getObjectById("cnt" + index).ntfocus();
        }
        if (isIE6){
            $("#fp-nav li a").css("background-position", "-15px 0");
            $("#fp-nav li a.active").css("background-position", "0 0");
            DD_belatedPNG.fix("#fp-nav li a");
        }
    },
    onLeave: function(index, nextIndex, direction){
        if(nextIndex == 6){
            return false;
        }
        swfobject.getObjectById("cnt" + nextIndex).ntunfocus();
    }
});
查看演示

下载本素材需消耗 10 积分

无法下载?立即反馈