Giter Site home page Giter Site logo

hellalightbox's Introduction

hellaLightBox.js

A hella lightweight lightbox jQuery plugin that centers and displays any element โ€“ and children of that element โ€“ that you pass to it as a jQuery selector.

Accepted parameters:

$('.lightbox').hellaLightBox(trigger[, options])

trigger (default: 400)
Type: Number or String
Either a jQuery selector delineating the element(s) that, when clicked, will trigger the lightbox or, if number, the amount of time (in milliseconds) to wait before launching lightbox on page load

options
Type: Object
A map of additional options to pass to the plugin

hideOnBgClick (default: true)
Type: Boolean
Determins if clicking outside the lightbox should hide the lightbox

triggerEvent (default: 'click')
Type: String
If the trigger is not a number, defines what type of event to bind to the trigger to show the lightbox

xOut (default: 'X')
Type: String
The content to place within the x-out button

Examples:

Fire lightbox 1.5 seconds after page load:

<div class="myLightbox">
  <span>Bunch o' stuff</span>
</div>
<script src="hellaLightBox.min.js"></script>
<script>
  $(function () {
    $('.myLightbox').hellaLightBox(2000);
  });
</script>

Fire lightbox on link click, change x-out text and don't exit hide lightbox when user clicks outside of it:

<a href="#" class="showLightbox">Click here to see my awesome photo!</a>
<div class="lightbox">
  <img src="awesome-photo.jpg">
</div>
<a href="#" class="showLightbox">Or click here!</a>

<script src="hellaLightBox.min.js"></script>
<script>
  $(function () {
    $('.lighbox').hellaLightBox('a.showLightbox', {
      xOut: 'Click to Exit',
      hideOnBgClick: false
    });
  });
</script>

A live example can be seen here.

hellalightbox's People

Contributors

lukewhyte avatar

Watchers

James Cloos 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.