• Stars
    star
    114
  • Rank 306,908 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple, responsive lightbox plugin.

simplebox.js

simplebox.js is a lightweight lightbox plugin (~936 bytes) that is easy to modify or extend to fit your needs. This plugin is intended to be a quick, responsive, efficient.

The idea behind this plugin was to make the process of setting up a lightbox painless. My experience with finding and setting up lightbox plugins has been pretty bad. The plugins I've come across almost always have too many features. simplebox.js is designed to have just one feature: lightboxing. It's responsive out of the box and allows only a few crucial settings.

Installation

To install simplebox, you will have to include the following resources in your page. The JS files should be loaded in the order stipulated below. For the CSS file, you can either incorporate it with your site's stylesheet, or load it externally through the <link> element in <head>.

Type File Name Description
JS jQuery jQuery is obviously needed
JS dist/js/simplebox.min.js Confers the main functionality of the plugin.
CSS dist/css/simplebox.min.css Offers styles that are crucial for the correct display of simplebox. The appearance will break if this is not included. Properties in this file include the necessary vendor prefixes.

Usage

Basic

It is rather straightforward to use simplebox—just add the slb class to all the images you want this plugin to work for and then simply chain the .simplebox() method to $(".slb") in your JavaScript.

<img class="slb" src="/path/to/image" alt="lorem ipsum" />
$(function () {
    $(".slb").simplebox();
});

Advanced

The plugin comes with four options. Yes, just four. Think of this as a feature and not a drawback! If you want to access these options, call the plugin like this:

$('.slb').simplebox({
    fadeSpeed: 300, // default is 400ms, applied to all fade animations in the plugin
    darkMode: true, // default is false
    postfix: "_full", // default is ""
    hqClass: "highres" // default is "hq"
});

You can use postfix and hqClass options to customize the path to the image used in the pop-up. For every image defined as <img src="[initial path].[extension]" class="slb [hqClass]" alt="[alt]"> simplebox will use <img src="[initial path][postfix].[extension]" class="slb" alt="[alt]">. Notice that you shouldn't use hqClass with images that don't have a version with the postfix.

Also, simplebox keeps the values of srcset and alt attributes in the pop-up image as well so you can do some cool things with srcset if you need to as well!


If you are using this plugin and want your product to be listed here, hit me up on @Ratik96 on Twitter!

More Repositories

1

sass-struct

A shell script that creates a folder structure for yo' Sass.
Shell
9
star
2

instagram-heart-demo

Instagram-like heart animation demo.
Java
8
star
3

snapcam

An attempt to replicate the Snapchat camera interface.
Java
7
star
4

goodlink

A direct link to Goodreads from Amazon. An essential browser plugin for Goodreads lovers.
JavaScript
6
star
5

colorgram

More colorful Instagram stories!
Kotlin
4
star
6

book-notes

Notes from books and other interesting things that I've read.
3
star
7

uttam

A perfectly crafted wallpaper, everyday.
Java
3
star
8

tipcalc

Tip Calculator toy-app showcasing Kotlin, MVVM and TDD.
Kotlin
2
star
9

ml-spam-filter

ML: baby steps.
Python
1
star
10

nutab

Minimal boilerplate code to whip up a New Tab page override for Google Chrome.
HTML
1
star
11

goodlink-safari

Swift
1
star
12

adventofcode

Advent of Code solutions in Kotlin!
Kotlin
1
star
13

ml-101-andrew-ng

MATLAB
1
star
14

mincast

Toy podcasts made with Jetpack Compose.
Kotlin
1
star
15

99-bottles

Sandi Metz' "99 Bottles of Beer" kata.
1
star
16

differential-engine

Command line tool to find derivatives.
C++
1
star
17

pizzakeeper

Toy app to mess around with Android Architecture Components.
Kotlin
1
star
18

advent2020

Solutions for Advent of Code 2020.
Python
1
star
19

webshop

Command line tool to create websites! [HTML and CSS]
C++
1
star
20

todo-flask

A todo application built using Flask.
Python
1
star
21

gilded-rose

My attempt at the Gilded Rose Kata.
JavaScript
1
star
22

xunit-tdd

Deliberate practice for TDD.
Python
1
star
23

mitronbot

Mitrrrronnnnn!
JavaScript
1
star
24

gpwh

Solutions to quick checks and per-lesson exercises.
Haskell
1
star
25

hbfsbot

A Twitter bot that tweets lyrics from the hit track Harder, Better, Faster, Stronger by Daft Punk.
JavaScript
1
star
26

isit

Fun little countdown to my friend Arjoonn's birthday!
CSS
1
star
27

mnml-ecosia

A Cleaner, more minimal version of Ecosia's New Tab Chrome extension.
HTML
1
star
28

graph

Command line tool to plot graphs.
C++
1
star