anc_rollover Plugin for Textpattern

About

This plugin allows you to specify two Textpattern images by name or ID, which will be displayed in the browser as a JavaScript rollover. (Try it out on the image to the right.)

Download

anc_rollover_0.1.txt

Documentation

This plugin behaves very much like the <txp:image/> tag, except that instead of a single id or name attribute, it requires two attributes:

  • idoff (The id of the image that will be displayed initially, and when the mouse rolls back out)
  • idon (The id of the image that will be displayed on mouse over)

or

  • nameoff (The name of the image that will be displayed initially, and when the mouse rolls back out)
  • nameon (The name of the image that will be displayed on mouse over)

You can’t mix and match; you must use idoff and idon together, or nameoff and nameon together. If either of the images are not found in the database, the tag returns nothing.

There are two more optional attributes:

  • style (The same as the style attribute of a normal XHTML Transitional tag
  • align (The same as the align attribute of a normal XHTML Transitional tag

Note that the rollover only swaps the image source; it does not alter the image’s dimensions, align, style, or alt properties, which are based on the ‘off’ image.

Examples

Assume you have two images in your Textpattern site:

  1. ‘Button Off’, whose ID is 27
  2. ‘Button On’, whose ID is 30

You can produce a rollover using either of these configurations:

  • <txp:anc_rollover idoff="27" idon="30"/>
  • <txp:anc_rollover nameoff="Button Off" nameon="Button On"/>

If you wanted the image to have a beveled, dark blue border you could also use the style attribute:

  • <txp:anc_rollover idoff="27" idon="30" style="border:2px outset #000066"/>

License

©2005 by Andy Chase

This plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Also

Syndicate content

Twitter

Older

Contact

Andy Chase
(978) 297-6402
andychase [at] gmail.com
GPG/PGP Public Key