基于jquery实现旋转切换banner导航特效代码



79 314 105



特效描述:基于jquery实现 旋转切换 banner 导航特效,基于jquery实现旋转切换banner导航特效代码

代码结构

1. 引入CSS

<link href="css/global.css" rel="stylesheet" />
<link href="css/global.css" rel="stylesheet" />

2. 引入JS

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>

3. HTML代码

<!DOCTYPE html>
<!--[if gt IE 8]><!-->
<html lang="en">
<!--<![endif]-->
<head id="Head1">
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title></title>
</head>
<body id="home" class="template-level-1 page-home" data-template="Home Page" data-level="1">
    <div id="divMain" class="page-container">
        <div id="js" class="no-js">
            <script>
                $("#js").attr("class", "js");
            </script>
            <a href="#contents" class="wai">Skip to Main Content</a>
            <div class="container">
                <div class="wrapper">
                    <div class="wrapper-inner">
                        <div class="banner">
                            <div id="banner-spin">
                                <div id="banner-copy">
                                    <h3>Add life and color to homes, and excitement to your career.</h3>
                                    <p>Whether it's a 1920's bungalow or a skyscraper, PPG is the master of architectural coatings. PPG's passion for revealing the beauty of buildings with color is matched only by their passion for protecting that beauty. Whether In trade channels or retail, PPG Architectural Coatings is dynamic and bustling, with many manufacturing and R&amp;D sites, and too many retail stores and dealer networks to list. Working for PPG means you'll bring opportunity to the surface in everything you do.</p>
                                </div>
                                <ul>
                                    <li id="performance1"><a href="#">Performance</a></li>
                                    <li id="performance2"><a href="#">Performance</a></li>
                                    <li id="architectural"><a href="#">Architectural</a></li>
                                    <li id="innovation1" class="innov"><a href="#">Innovation</a></li>
                                    <li id="innovation2" class="innov"><a href="#">Innovation</a></li>
                                    <li id="global"><a href="#">Global</a></li>
                                    <li id="optical1"><a href="#">Optical</a></li>
                                    <li id="optical2"><a href="#">Optical</a></li>
                                </ul>
                                <ul id="content">
                                    <li class="performance1">
                                        <h3 class="purple">As it turns out, watching paint dry can be pretty amazing.</h3>
                                        <p class="wide">At PPG, we know what goes into the world's best coatings &mdash; the technology, the innovation and the new ideas. That's why we give our teams unmatched training and unparalleled resources. With our Automotive group, you'll work on coating's cutting edge. And you'll bring opportunity to the surface in everything you do.</p>
                                        <a href="images/performance1-big.png"></a>
                                    </li>
                                    <li class="performance2">
                                        <h3 class="purple">As it turns out, watching paint dry can be pretty amazing.</h3>
                                        <p class="wide">At PPG, we know what goes into the world's best coatings &mdash; the technology, the innovation and the new ideas. That's why we give our teams unmatched training and unparalleled resources. With our Automotive group, you'll work on coating's cutting edge. And you'll bring opportunity to the surface in everything you do.</p>
                                        <a href="images/performance2-big.png"></a>
                                    </li>
                                    <li class="architectural">
                                        <h3>Add life and color to homes, and excitement to your career.</h3>
                                        <p>Whether it's a 1920's bungalow or a skyscraper, PPG is the master of architectural coatings. PPG's passion for revealing the beauty of buildings with color is matched only by their passion for protecting that beauty. Whether In trade channels or retail, PPG Architectural Coatings is dynamic and bustling, with many manufacturing and R&amp;D sites, and too many retail stores and dealer networks to list. Working for PPG means you'll bring opportunity to the surface in everything you do.</p>
                                        <a href="images/arch1-big.png"></a>
                                    </li>
                                    <li class="innovation1">
                                        <h3 class="red">We see the power of ideas.
                                                <br />
                                            Your ideas.</h3>
                                        <p>As the world's leader in coatings and specialty products, PPG knows a thing or two about protection. We also know growth. And innovation. Join us, and you'll see what it means to be supported and encouraged. You'll also have the chance to bring opportunity to the surface. Working for PPG means you'll bring opportunity to the surface in everything you do.</p>
                                        <a href="images/innovation1-big.png"></a>
                                    </li>
                                    <li class="innovation2">
                                        <h3 class="red">We see the power of ideas.
                                                <br />
                                            Your ideas.</h3>
                                        <p>As the world's leader in coatings and specialty products, PPG knows a thing or two about protection. We also know growth. And innovation. Join us, and you'll see what it means to be supported and encouraged. You'll also have the chance to bring opportunity to the surface. Working for PPG means you'll bring opportunity to the surface in everything you do.</p>
                                        <a href="images/innovation2-big.png"></a>
                                    </li>
                                    <li class="global">
                                        <h3 class="green">When you're everywhere,
                                                <br />
                                            you can work anywhere.</h3>
                                        <p class="wide">Our innovation and mastery of coatings, glass and optical products mean that we've had the opportunity to expand to every corner of the globe. Working with PPG means unmatched access to resources and training. Where you start will be very different from where you end up. With unmatched training and unparalleled resources, you'll bring opportunity to the surface in everything you do.</p>
                                        <a href="images/global0-big.png"></a>
                                    </li>
                                    <li class="optical1">
                                        <h3 class="pink">With PPG, you really can see yourself just about anywhere.</h3>
                                        <p>From lenses and their coatings, consumer products to solar panels, PPG has made an art of improving how we see the light of day. Working for PPG could change the way you look at a career, too. With unmatched training and unparalleled resources, you'll bring opportunity to the surface in everything you do.</p>
                                        <a href="images/optical1-big.png"></a>
                                    </li>
                                    <li class="optical2">
                                        <h3 class="pink">With PPG, you really can see yourself just about anywhere.</h3>
                                        <p>From lenses and their coatings, consumer products to solar panels, PPG has made an art of improving how we see the light of day. Working for PPG could change the way you look at a career, too. With unmatched training and unparalleled resources, you'll bring opportunity to the surface in everything you do.</p>
                                        <a href="images/optical2-big.png"></a>
                                    </li>
                                </ul>
                            </div>
                            <!--/#banner-spin-->
                        </div>
                    </div>
                    <!--/.wrapper-inner-->
                </div>
                <!--/.wrapper-->
            </div>
            <!--/.container-->
        </div>
        <!--/.no-js-->
        <script>
            var startCopy = new Object();
            var newCopy = new Object();
            function changeText(obj) {
                $('#loading').hide();
                $('#banner-copy').fadeOut(200, function () {
                    $(this).children('h3').html(obj.headline);
                    if (obj.h3class) { $(this).children('h3').addClass(obj.h3class); }
                    else { $(this).children('h3').attr('class', ''); }
                    if (obj.pclass) { $(this).children('p').addClass(obj.pclass); }
                    else { $(this).children('p').attr('class', ''); }
                    $(this).children('p').html(obj.copy);
                    $(this).fadeIn(400);
                });
            }
            function getContent(name) {
                displayname = name.slice(0, name.length - 1);
                //create overlay with image and close button
                if (!$('#banner-img').length) {
                    $('#banner-spin').append($('<div id="banner-img"><img src="" alt=""/><a href="#" id="banner-close">Close</a></div>'));
                    $('#banner-close').unbind().click(function () {
                        $(this).hide();
                        clear();
                        return false;
                    });
                }
                $('#banner-img').removeClass('hidden');
                //get new text content before image load
                newCopy.headline = $('.' + name + ' h3').html();
                newCopy.copy = $('.' + name + ' p').html();
                if ($('.' + name + ' h3').attr('class').length) {
                    newCopy.h3class = $('.' + name + ' h3').attr('class');
                }
                if ($('.' + name + ' p').attr('class').length) {
                    newCopy.pclass = $('.' + name + ' p').attr('class');
                }
                //get banner image source from hidden content and load into banner-img div	
                if ($('#banner-img img').attr('src') != $('.' + name + ' a').attr('href')) {
                    $('#banner-img img').attr({
                        src: $('.' + name + ' a').attr('href'),
                        alt: displayname,
                    });
                    $('#banner-img img').load(function () {
                        $('#banner-img img, #banner-close').fadeIn(400);
                        changeText(newCopy);
                    });
                }
                else {
                    $('#banner-img img, #banner-close').fadeIn(400);
                    changeText(newCopy);
                }
            }
            //  关闭
            function clear() {
                $('.active').addClass('closing').removeClass('active');
                $('#banner-img img').fadeOut(400, function () {
                    $('#banner-img').addClass('hidden');
                    $('#banner-spin a').removeClass('closing');
                });
                newCopy.h3class = '';
                newCopy.pclass = '';
                changeText(startCopy);
            }
            $(document).ready(function () {
                $('#banner-spin').append($('<div id="banner-wheel"></div><div id="loading"></div><div id="cover"></div>'));
                $('#banner-spin').animate({ opacity: 0 }, 0).css('visibility', 'visible');
                setTimeout(function () { $('#banner-spin').animate({ opacity: 1 }, 400) }, 500);
                //to save first page copy for reset
                startCopy.headline = $('#banner-copy h3').html();
                startCopy.copy = $('#banner-copy p').html();
                $('#banner-spin a').click(function () {
                    $(this).addClass('active');
                    getContent($(this).parent('li').attr('id'));
                    return false;
                });
            });
        </script>
    </div>
    <!--/.page-container-->
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>
</html>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 瀑布流 收藏 预览 自适应页面大小 响应式区块列表布局 摇摆 烟花 清单样式 照相机 注释 下划线 结构图 鼠标悬停 条形码 弹幕 画板 朋友圈样式 红包 css绘制样式 支付 图文布局 导航切换 二级导航菜单 二维码 下拉导航菜单 地图 图片切换 竖直导航菜单 计算器 文字切换 图标导航菜单 计时器 背景切换 固定导航菜单 桌面 手风琴 侧边导航菜单 跳转 选项卡自动切换 树形导航菜单 步骤 视频切换 网址导航菜单 键盘 列表切换 导航菜单插件 签到 分享 渐隐切换 文字导航菜单 点赞 投票 全屏切换 雪花 切换按钮 打印 缩放切换 答题 震动 图表 鼠标滑过 抽奖 表情 qq空间 头像截图 星星打分评分 编辑器 播放器 电子杂志 排行榜 分页翻页 排序 表格隔行变色 table表格 进度条 多功能 滚动导航菜单 滑动导航菜单 浮动导航菜单 导航切换 右键菜单 收缩导航菜单 html5动画导航菜单 flash导航菜单 滚动切换 滑动选项卡切换 选项卡切换 滑动手风琴 滑动星星打分 导航菜单导航条 其他更多

×
×
51前端

注册

官方QQ群
qq群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到