& Lt; span & gt; test & lt;/span & gt;
& Lt; span & gt; test & lt;/span & gt;
& Lt; span & gt; test & lt;/span & gt;
& Lt; span & gt; test & lt;/span & gt;
& Lt; span & gt; test & lt;/span & gt;
& Lt; span & gt; test & lt;/span & gt;
Copy code
The code is as follows:
$(document).ready(function(){
$(".menu").mouseover(function(){
var div = $(this).children(".menu_b");
var span = $(this).children("span");
//Hide font, move 20px to the right
span.stop(true,false).animate({opacity:'0',left:'20px'},200);
//Show background animation
div.stop(true,false).animate({width:'100px',marginLeft:'-50px',height:'1px',opacity:'1'},300);
div.animate({height:'40px',marginTop:'-20px',opacity:'1'},300);
//Display font, move 20px to the left
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 20px to the left
span.stop(true,false).animate({opacity:'0',left:'20px'},200);
//Show background animation
div.stop(true,false).animate({height:'1px',marginTop:'0px',opacity:'1'},300);
div.animate({width:'0px',marginLeft:'0px',opacity:'1'},300);
//Display font, move 20px to the right
span.animate({opacity:'1',left:'0px'},300);
span.css({color:'#777'});
});
});
I wrote the animation effects according to my own preferences. You can change the special effects yourself if you like. .
The code is very simple, and it is also very simple to use, including modifications. You can figure it out by yourself
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn