Giter Site home page Giter Site logo

mailto-creation's Introduction

mailto-creation

Create a custom mailto with data attributes

Start

You must first install NPM dependencies and run start script :

npm install
npm start

How to use it

Mailto-creation uses UMD (Universal Module Definition) pattern.

Global object :

const mailto = new Mailto({
    selector: '.my-custom-selector',
    defaultSubject: 'My default subject'
});

mailto.init();

AMD :

require(['mailto'], (Mailto) => {
    const mailto = new Mailto({});

    mailto.init();
});

Examples

Add "js_mailto" class on the clicked element, with two data attributes : "data-recipient" and "data-subject". Subject is not obligatory, and your can set a default subject inside options object.

<a href="#" title="Send an e-mail to us" class="js_mailto" data-recipient="[email protected]" data-subject="Contact from website">
  Send an e-mail to us
</a>

Demo

You can see demo by opening index.html file inside /demo folder.

mailto-creation's People

Contributors

thibaultboursier avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.