Direction picture gradient animation effect based on jquery_jquery
WBOYOriginal
2016-05-16 18:26:301053browse
Another point is the use of filters, but one thing that must be explained is that filters cannot be recognized and the effect is not visible in Firefox. Let’s start writing our code html is relatively simple The code
myjquerydirection < META http-equiv=content-type content="text/html; charset=gb2312">
An island
;/li>
A tree with green leaves
A big tree
Sunflowers in a field
< ;/div>
There are multiple div tags with id=frontTextBack here It shows that the shadow is realized through the css filter. There is nothing to say about the other code Now let’s start writing our css code First start writing the code from the top level
$(function(){ //First find the img that needs to be clicked $("li img").click(function(){ //Determine whether the current img Already clicked if(this.className.indexOf("active") !=-1) { return; } //Get data var i= $(this).attr("pic"); //Get the text content to be displayed, and split the text into arrays with | var t=$(this).attr("text"). split("|"); //Change the fade-out of the text and change the animation effect by controlling the transparency $("#frontText").fadeOut(); $("#frontTextBack") .fadeOut(); $("#frontTextSub").fadeOut(); //Process the currently active img and restore it to its original state $("li img.active").animate({top: 5,width:52,left:10},300) .removeClass("active") .fadeTo(200,0.6) //Process the current active img $(this ).animate({top:-5,width:40,height:70,left:1},300) .addClass("active") .fadeTo(200,1) // Process the large image of the displayed div $("#back").children().addClass("gray").end() .fadeIn(500,0.1,function(){ $ (this).children("img").attr("src","imgaes/" i ".jpg").removeClass("gray"); $(this).fadeTo(500,1,function (){ $("#frontText").html(t[0]).fadeIn(200); //Change the text $("#frontTextBack").html(t[0]) .fadeIn(200); //Shadow text $("#frontTextSub").html(t[1]).fadeIn(200)} //Subtitle ); }); }); }); //Initialize the first picture var i =0; show(); function show(){ if (i= =$("li img").size()) i = 0 $("li img").eq(i).click(); i ; //setTimeout(show( ),1000); }
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