Giter Site home page Giter Site logo

outsider.js's Introduction

outsider.js

outsider.js is a tiny library for jQuery that lets you execute a function whenever a click comes from outside a given element. A common use case is to hide or remove a certain dialog element whenever the user clicks somewhere else, but it is flexible enough for anything you can think of.

Usage

The outsider function accepts either a string or function as an argument. Use a string to call a jQuery function on an element, like hide:

$(".some-element").outsider("hide");

You can also pass some additional arguments to the function if you'd like:

$(".some-element").outsider("fadeOut", 1000);

Or you can pass a function and execute any code you want:

$(".some-element").outsider(function(event, element) {
  this.html("You clicked outside!");
});

The value of this is bound to the element, but also accessible as the second argument in case you decide to bind this to something else. The click event can be accessed through the first argument.

License

The MIT License.

outsider.js's People

Contributors

jcxplorer avatar

Stargazers

 avatar Miguel Amaral avatar Khalid Laouhi avatar

Watchers

Stephen Sykes avatar  avatar Piermaria Cosina avatar  avatar James Cloos avatar Matias Kirvelä avatar Nils Forsblom avatar  avatar  avatar  avatar

outsider.js's Issues

Refresh and Online demo?

Would be good to refresh/update to modern browsers to conform your project is up to date; have an online demo for us to test:)

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.