In jQuery all effects are applied simultaneously, to all elements selected by the query, with EffectChain you can apply all jQuery effects (1.2+) in a chain (sequence). ALL effects are supported: hide, show, fadeIn, fadeOut, fadeTo & animate! Moreover with EffectChain you can shuffle the order of the effect on the DOM elements (reverse or random), setup delays between the application of the effect to an element plus many more features, and all these with a minimal footprint!
In order to work you need the jQuery library (version 1.2.+) and the javascript file of the EffectChain. Once you have them, link them inside the head of your html file:
don't forget to replace "folderName" with the folder that you've stored the two ".js" files.
jTypeWriter has been test for compatibility issues with the following broswers:
Probably it will work, with earlier versions of Opera and Safari, but I haven't try it out.
To properly use the EffectChain plugin, you must first make sure that the DOM is ready to be traversed and manipulated. To acheive that the code of any EffectChain implementation must reside inside the event ready. For example let's assume you want to apply the EffectChain effect in a series of elements: <div class="box> and you want to make them disappear in 3 seconds (each).
An alternative way to achieve the same thing, is to ensure that the EffectChain is placed after the DOM element that you want to handle. Although it's not the "appropriate" way, you could do it (for example the Google analytics javascript code, is placed before the end of the <body>).
EffectChain plugin can accept 6 different parameters that can change the effect applied to the DOM elemets that are selected. Don't forget that the same effect will be applied to all DOM elements selected with EffectChain:
0.$("elements").EffectChain({effect:"animate",animateParams:{ property1:"stringValue", proptery2:numericValue, .., propertyX:"value value value"}}); EffectChain is a very versitile improvement on the jQuery effect engine. It enables you to animate a series of same objects, let's say products or news in your page.
Let's assume that in your first page of your website you have some 9 <div class="box"> elements that contain inside them your most famous products/books/articles/software etc and you want to present them in a nice way...let's say fade in, then your code will be: $('div.box).fadeTo(0,0).EffectChain({effect:"fadeTo",fadeToOpacity:1});
I believe that with the correct use of CSS the possibilities and combinations are endeless.
Use of EffectChain, without any parameters to a series of div elements. Without any parameters passed to EffectChain, you have a hide effect to all elements, in normal order and the duration is 1 second for each animation. A very importan think to note is that, the jQuery selector must "collect" more than one elements. In the examples bellow I give all <divs> the same class name.
CODE: $('.exampleA').EffectChain();
All divs have the same class name:"exampleA", thus the selectors is $(".exampleA").
If we set the duration parameter to 2.5 the animation effect of each item will last for 2.5 seconds.
By setting the delay parameter to 1 we force a 1 second delay between the effect of each element.
Finally in this example we set the parameter effect to "show", in order to display the items, that are hidden. In the code bellow you will see that I use jQuery to instantly hide the items and then apply EffectChain, all in one line of code!
CODE: $('.exampleB').hide().EffectChain({duration:2.5,delay:1,effect:"show"});
EffectChain comes with two types of events (functions), that can be fired when each effects ends and a final events, when all effects have completed.
The OnStep function fires each time an effect is completed in an element. If we have 4 elements, a function will be fired 4 times.
The OnComplete function fires once, after all effects are complete.
For simplicity's sake, I place the functions for both events inline to save space. When you use it, I suggest to assign a referance to the functions name.
CODE: $('.exampleC').hide().EffectChain({effect:"fadeIn",onStep:function(){alert('step');},onComplete:function(){alert('complete');}});
The default display order of the effect is the one used by the DOM tree. If you want to change that, you can set the order parameter to either: "reverse" or "random". If you do that, then the effect will not be shown in the DOM tree order, but the one you have set.
CODE: $('.exampleD').fadeTo(0,0).EffectChain({order:"random",effect:"fadeTo",fadeToOpacity:0.8});
You can download a set of files, full of working examples. Click bellow to download it!
Download EffectChain v1.0 examples!EffectChain is released under GPL Open Source Licenses...thus it is completely and totally free!. You are obligated to keep all credits (links, names etc) and if you feel like it a link to this page will be appreciated!
Comments
CSS problem !
Regarding previous message sorry for the noise, problem solved, it just works great
Thank you
I am glad you 've solved it!
Let me know if you need anything else :).
Great !
Great work and thank you
I am having a small trouble personnalizing with CSS the look of the last element appearing, color and size of text but positioning (padding ) doesn't seem to work . Any ideas why ?
Awesome
Pizdets awesome! you're cool!
greats, good works ;D
greats,
good works ;D
Post new comment