Documentation

So how can I use this gift from the heavens?

It's easy! There are four things you need to do:

  1. Put the following into the head section on any page of your website where you want to use WordTossing:

    <script type="text/javascript" src="//code.jquery.com/jquery.min.js"></script><script type="text/javascript" src="//wordtossing.com/js/toss.js"></script>

    If you're already calling jQuery there's no need to include it twice. You can leave that line out.

  2. Designate any p element that you want to toss with a special class as follows:

    <p class="toss">

    As an extra command here, you can also designate that only more common words should be returned. This is done as follows:

    <p class="toss common">
  3. Within any paragraph that you have designated to be tossed, you need to designate the specific words to toss by wrapping them in a span and choosing the word type by giving the span a class:

    <span class="noun">zebra</span>
  4. Lastly, you need to designate an element that will initiate the tossing. This can be any clickable element on the page. You simply add a class like this:

    class="tossclicker"

A completed setup will look something like this:

<p class="toss" class="common">This is a <span class="adjective">cool</span> <span class="noun">paragraph</span>.</p><p><button class="tossclicker">Toss</button></p>

And function like this:

This is a cool paragraph.

What types of words can I designate?

You can choose any of the following as the type attribute within a span:

  • noun
  • adjective
  • verb
  • adverb
  • interjection
  • pronoun
  • preposition
  • abbreviation
  • affix
  • article
  • auxiliary-verb
  • conjunction
  • definite-article
  • family-name
  • given-name
  • idiom
  • imperative
  • noun-plural
  • noun-posessive
  • past-participle
  • phrasal-prefix
  • proper-noun
  • proper-noun-plural
  • proper-noun-posessive
  • suffix
  • verb-intransitive
  • verb-transitive