On Aug 8, 6:17 pm, Sam Collett <[EMAIL PROTECTED]> wrote:
> You like developing plugins don't you? ;)

:D

jQuery makes it too easy to do. This particular plugin has a trivial
implementation:

jQuery.fn.initSpoilers = function( props ) {
        props = jQuery.extend({
                revealedClass:'reveal'
                },
                props ? props : {});
        this.hover(
                function() { $
(this).addClass( props.revealedClass ); },
                function() { $
(this).removeClass( props.revealedClass ); }
        );
        return this;
};

Most of the real work happens via CSS.

> How about an option to show the spoilers when you click on a link
> 'show spoilers'. I've seen a few forums (can't think of the exact
> URL's off the top of my head though) that have this. e.g. $
> ('.jqSpoiler').initSpoilers("click") or $
> ('.jqSpoiler').initSpoilers("hover")

i was thinking not only of that, but also of how best to integrate
optional hoverIntent support (since hoverIntent is quite popular). i'm
trying to consolidate the discrepancies between click and hover, so
that the option can be integrated in a unified way (i hate special-
case code).

For the click, i was thinking: clicking on the overlay will unhide the
text, and mouse-out will hide it again, but that might be tedious/
annoying in practice (haven't tried it yet). Your thoughts? Should a
second click be required to re-hide the text? i think re-hiding may
not be necessary: if a click is used to un-hide then the user
obviously wants to reveal the text, and re-hiding it is probably not
desired.


Reply via email to