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



34 135 46



特效描述:基于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>



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


热门标签: flash导航菜单 flash导航条 flash导航 flash菜单 flash下拉菜单 flash下拉导航菜单 导航切换 菜单切换 右键菜单 滑动导航菜单 滑动导航 滑动菜单 滚动导航菜单 滚动菜单 滚动导航 收缩菜单 收缩导航 h5动画导航 h5动画菜单 html5动画导航 html5动画菜单 浮动菜单 浮动导航 滚动切换 滚动条切换 滑动选项卡 滑动切换 滑动手风琴 选项卡切换 选项卡 切换 tab切换 页面切换 选项卡插件 切换插件 滑动星星打分 导航菜单 导航条 菜单栏 导航栏 分类导航 响应式导航条 响应式导航 其他 预览 图片切换 图片选项卡 图标选项卡 图标导航 图标菜单 导航菜单插件 导航插件 菜单插件

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

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

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