//Roberto Mazzucchelli

RobertoMazzucchelliDotCom

Ago

26

Toggle-o-matic v0.2 for Mootools 1.2

Inserito da Mazzu il 26 Agosto 2008

code

Toggle-o-matic lets you add multiple toggle and slide elements to a page simply by matching a class suffix



demo

Check out a live demo of the toggle-o-matic v0.2 here.


features

  • create a slide effect with no coding or configuration
  • automatically adds cursor to toggle control
  • use a single control to toggle many elements or one

installation


  1. Download mootools 1.2;
  2. Download mootools 1.2 “more” library (which includes the FX.slide);
  3. Upload the toggle-o-matic code between script tags (

    ), before () or save the javascript write in this page as toggleomatic.js and link it to your homepage’s code.

configuration

For makes work this script just follow this next instruction:

  • Javascript
  • var toggleOmatic = function() {
     var toggleAll = $(document.body).getElements(‘[class$=_toggle]‘);
     toggleAll.each(function(item){
     item.setStyle(‘cursor’, ‘pointer’);
     var toggleAllClass = item.getProperty(‘class’);
     toggleAllClass = toggleAllClass.replace("_toggle", "");
     var slideAllClass = toggleAllClass + "_slide";
     var slideAll = $(document.body).getElements(‘.’ + slideAllClass);
     slideAll.slide(‘hide’);
     $(item).addEvent(‘click’, function(){
     slideAll.slide();
     });
     });
     }
    window.addEvent(‘domready’, function() {
     toggleOmatic();
     });
  • Html
  • <a class="this_toggle" href="#">Toggle</a>
    <div class="this_slide">Toggle this element</div>
    <a class="abunch_toggle" href="#">Toggle</a>
    <div class="abunch_slide">Toggle many elements</div>
    <div class="abunch_slide">Toggle multiple elements</div>
    <div class="abunch_slide">Multiple element toggle

regards

This work was made by consideropen.org


Tags: , , ,

Post simili:

4 Commenti per “Toggle-o-matic v0.2 for Mootools 1.2”

  1. Troy Dice:
    26 Agosto 2008 at 5:46 pm

    Hey, id recommend checking out this article. The code is public domain, feel free to do what you would like with it, but reprinting the article messes with my rankings and readership. Please remove this article and write a summary, linking to the original article. Do not reprint entire articles. Very bad practice. Can mess up your rankings too.

    Thanks.
    Troy

    http://www.associatedcontent.com/article/908549/stolen_blog_content_reprinting_articles.html?cat=17

  2. Mazzu Dice:
    26 Agosto 2008 at 9:18 pm

    Hi, I’m sorry for the mistake; I’ve changed all possible, it’s the same only the code and a list. I hope it’s ok now :)

  3. Mark Dice:
    12 Ottobre 2008 at 4:11 pm

    Hi,

    Good script, but is it possible to retrun the flag status?

    if ( flag == ‘true’){}?

    thanks

  4. Mazzu Dice:
    13 Ottobre 2008 at 1:34 pm

    Yes it’s possible.. u mean, when, for example, u reload the page and u wanna see the status of the slide?

Lascia un commento

Copyright © 2007 //Roberto Mazzucchelli - Theme by Lauryn.it - Sponsored by Italianwebdesign - Icons by Sweetie