Awesome jquery imitation flash navigation bar effects

  • 2020-03-30 04:16:20
  • OfStack

FLASH navigation is basically out of date now, but we can use jQuery to implement FLASH effects, very good.

Demo address: (link: http://demo.jb51.net/js/2014/jqeryfangflashdh/demo.html)


<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 
    <title>demo01</title> 
    <link rel="stylesheet" type="text/css" href="demo.css"> 
    <script type="text/javascript" src="jquery.js"></script> 
    <script type="text/javascript" src="demo.js"></script> 
</head> 
<body> 
        <div id="main"> 
        <div class="menu"> 
            <div class="menu_b back1"></div> 
            <span> test </span> 
        </div> 
        <div class="menu"> 
            <div class="menu_b back2"></div> 
            <span> test </span> 
        </div> 
        <div class="menu"> 
            <div class="menu_b back3"></div> 
            <span> test </span> 
        </div> 
        <div class="menu"> 
            <div class="menu_b back4"></div> 
            <span> test </span> 
        </div> 
        <div class="menu"> 
            <div class="menu_b back5"></div> 
            <span> test </span> 
        </div> 
        <div class="menu"> 
            <div class="menu_b back6"></div> 
            <span> test </span> 
        </div> 
        </div> 
</body> 
</html> 

 

$(document).ready(function(){ 
    $(".menu").mouseover(function(){ 
        var div = $(this).children(".menu_b"); 
        var span = $(this).children("span"); 
        //Hide the font, move 20px& NBSP; to the right; < br / >         span.stop(true,false).animate({opacity:'0',left:'20px'},200); 
        //Show background animation & NBSP; < br / >         div.stop(true,false).animate({width:'100px',marginLeft:'-50px',height:'1px',opacity:'1'},300); 
        div.animate({height:'40px',marginTop:'-20px',opacity:'1'},300); 
        //To display the font, move 20px& PI to the left; < br / >         span.animate({opacity:'1',left:'0px'},300); 
        span.css({color:'#FFF'}); 
    }); 
 
    $(".menu").mouseout(function(){ 
        var div = $(this).children(".menu_b"); 
        var span = $(this).children("span"); 
        //Hide font, move left 20px& NBSP; < br / >         span.stop(true,false).animate({opacity:'0',left:'20px'},200); 
        //Show background animation & NBSP; < br / >         div.stop(true,false).animate({height:'1px',marginTop:'0px',opacity:'1'},300); 
        div.animate({width:'0px',marginLeft:'0px',opacity:'1'},300); 
        //To display the font, move 20px& PI to the right; < br / >         span.animate({opacity:'1',left:'0px'},300); 
        span.css({color:'#777'}); 
    }); 
}); 

  Animation effect is I according to their own preferences to write, like can change their own effects.


 
#main{ 
    background: #EEE; 
    display: inline-block; 
    padding: 10px; 

.menu{position: relative; 
    width: 100px; 
    height: 40px; 
    margin: 10px auto; 

 
.menu_b{ 
    position: absolute; 
    width: 0px; 
    height: 0px; 
    background: red; 
    z-index: 1px; 
    top: 50%; 
    left: 50%; 

.menu span{ 
    position: inherit; 
    display: block; 
    text-align: center; 
    line-height: 40px; 
    z-index: 3px; 
    font-size: 14px; 
    font-family: "Microsoft Yahei"; 
    color: #777; 
    cursor: pointer; 

.back1{ 
    background: #FF0000; 

.back2{ 
    background: #921AFF; 

.back3{ 
    background: #00CACA; 

.back4{ 
    background: #00DB00; 

.back5{ 
    background: #FF5809; 

.back6{ 
    background: #E1E100; 

The code is very simple, use is also very simple, including the modification are simple, friends do it by themselves


Related articles: