JavaScripting

The definitive source of the best
JavaScript libraries, frameworks, and plugins.


  • ×

    Add distraction mode for forms
    Filed under 

    • 🔾6%Overall
    • 62
    • 77.5 days
    • 🕩8
    • 👥4

    About

    Zen Form is a jQuery based plugin with which you can easily add a distraction free mode for your forms. It's much easier to wirte posts, comments and messages this way.

    Demo

    Please go here to view a sample

    Usage

    Apply your custom class to form or an input, textarea, select. Here're some samples:

    HTML:

    <form action="/" class="zen-mode">
        <label for="input:name">Name:</label>
        <input type="text" id="input:name" name="name" data-label="Type your name here...">
        <label for="input:message">Message:</label>
        <input type="text" id="input:message" name="message" data-label="And your message...">
    </form>
    
    <form action="/">
        <label for="input:message">Message:</label>
        <input type="text" id="input:message" name="message" class="zen-mode" data-label="Type your message here...">
    </form>
    

    JavaScript:

    $('.zen-mode').zenForm();
    

    Settings

    trigger '.go-zen'

    Element with this selector will open zen mode

    theme [dark, light]

    Default theme state

    data-label

    It's a html attribute you can add for an input, textarea or select. This will be used as label text.

    Events

    • zf-initialize function(event)
    • zf-initialized function(event, Environment)
    • zf-destroy function(event, Environment)
    • zf-destroyed function(event)

    Usage

    $('.zen-form').on('zf-initialized', function(event, Environment) {
        console.log(Environment)
    });
    

    Commands

    init

    Trigger zen mode

    destroy

    Close zen mode

    Usage

    $('.zen-form').trigger('init');
    

    License

    MIT Licensing

    Copyright (c) 2013 Kasper Mikiewicz

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Show All