Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mini-lightbox

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-lightbox - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

CONTRIBUTING.md

14

lib/mini-lightbox.js
// MiniLightbox
// </> with <3 by Ionică Bizău
(function (window) {
(function (root) {
window.addEventListener("scroll", function () {
root.addEventListener("scroll", function () {
MiniLightbox.close();
});
window.addEventListener("keydown", function (e) {
root.addEventListener("keydown", function (e) {
if (e.which !== 27) { return; }

@@ -65,2 +65,6 @@ MiniLightbox.close();

for (var i = 0; i < elms.length; ++i) {
new Image(elms[i].getAttribute("data-image-opened"));
}
if (options.delegation) {

@@ -121,3 +125,3 @@ return document.querySelector(options.delegation).addEventListener("click", function(e) {

window.MiniLightbox = MiniLightbox;
})(window);
root.MiniLightbox = MiniLightbox;
})(this);
{
"name": "mini-lightbox",
"version": "1.0.0",
"version": "1.1.0",
"description": "Minimalist image lightbox",

@@ -21,8 +21,70 @@ "main": "index.js",

],
"author": "Ionică Bizău <bizauionica@gmail.com>",
"license": "MIT",
"author": "Ionică Bizău <bizauionica@gmail.com> (http://ionicabizau.net)",
"license": "KINDLY",
"bugs": {
"url": "https://github.com/ionicabizau/mini-lightbox/issues"
},
"homepage": "https://github.com/ionicabizau/mini-lightbox"
}
"homepage": "https://github.com/ionicabizau/mini-lightbox",
"blah": {
"description": [
"## Demo",
"Check out [the demo page](http://ionicabizau.github.io/mini-lightbox).",
"",
"## Examples",
"",
"### Simple usage",
"",
"```html",
"<img id=\"myImage\" src=\"myImage.png\" alt=\"Some title\">",
"<script>",
"MiniLightbox(\"#myImage\");",
"</script>",
"```",
"",
"### Advanced usage",
"If you need more stuff (e.g. animations etc), you need to create custom handlers (`customClose` and `customOpen` handlers). Works like a charm with animate.css library. :smile:",
"",
"```js",
"MiniLightbox.customClose = function () {",
"var self = this;",
"self.img.classList.add(\"animated\", \"fadeOutDown\");",
"setTimeout(function () {",
"self.box.classList.add(\"animated\", \"fadeOut\");",
"setTimeout(function () {",
"self.box.classList.remove(\"animated\", \"fadeOut\");",
"self.img.classList.remove(\"animated\", \"fadeOutDown\");",
"self.box.style.display = \"none\";",
"}, 500);",
"}, 500);",
"// prevent default library behavior",
"return false;",
"};",
"",
"MiniLightbox.customOpen = function () {",
"this.box.classList.add(\"animated\", \"fadeIn\");",
"this.img.classList.add(\"animated\", \"fadeInUp\");",
"};",
"```",
"",
"### Using `data-image-opened` attribute",
"If `data-image-opened` attribute is provided in `img` element, it will be used for the path of the image when the popup is opened.",
"",
"```html",
"<img id=\"myImage\" data-image-opened=\"./big.png\" src=\"small.png\" alt=\"Some title\">",
"```",
"",
"### Delegation",
"If images are added dynamically, you need to use delegation:",
"",
"```js",
"MiniLightbox({",
"\"selector\": \".content img\"",
"// or the common parent where the images are appended",
", delegation: \"html\"",
"});",
"```"
],
"show_docs": false,
"license_year": "2014\n"
}
}

@@ -1,15 +0,7 @@

# mini-lightbox
# mini-lightbox [![Support this project][donate-now]][paypal-donations]
Minimalist image lightbox
## Installation
Run the following commands to download and install the application:
```sh
$ git clone https://github.com/ionicabizau/mini-lightbox mini-lightbox
$ cd mini-lightbox
$ npm install
```
## Demo
Checkout [the demo page](http://ionicabizau.github.io/mini-lightbox).
Check out [the demo page](http://ionicabizau.github.io/mini-lightbox).

@@ -23,3 +15,3 @@ ## Examples

<script>
MiniLightbox("#myImage");
MiniLightbox("#myImage");
</script>

@@ -33,19 +25,19 @@ ```

MiniLightbox.customClose = function () {
var self = this;
self.img.classList.add("animated", "fadeOutDown");
setTimeout(function () {
self.box.classList.add("animated", "fadeOut");
setTimeout(function () {
self.box.classList.remove("animated", "fadeOut");
self.img.classList.remove("animated", "fadeOutDown");
self.box.style.display = "none";
}, 500);
}, 500);
// prevent default library behavior
return false;
var self = this;
self.img.classList.add("animated", "fadeOutDown");
setTimeout(function () {
self.box.classList.add("animated", "fadeOut");
setTimeout(function () {
self.box.classList.remove("animated", "fadeOut");
self.img.classList.remove("animated", "fadeOutDown");
self.box.style.display = "none";
}, 500);
}, 500);
// prevent default library behavior
return false;
};
MiniLightbox.customOpen = function () {
this.box.classList.add("animated", "fadeIn");
this.img.classList.add("animated", "fadeInUp");
this.box.classList.add("animated", "fadeIn");
this.img.classList.add("animated", "fadeInUp");
};

@@ -66,20 +58,31 @@ ```

MiniLightbox({
"selector": ".content img"
// or the common parent where the images are appended
, delegation: "html"
"selector": ".content img"
// or the common parent where the images are appended
, delegation: "html"
});
```
## Installation
```sh
$ npm i mini-lightbox
```
## How to contribute
Have an idea? Found a bug? See [how to contribute][contributing].
1. File an issue in the repository, using the bug tracker, describing the
contribution you'd like to make. This will help us to get you started on the
right foot.
2. Fork the project in your account and create a new branch:
`your-great-feature`.
3. Commit your changes in that branch.
4. Open a pull request, and reference the initial issue in the pull request
message.
## Where is this library used?
If you are using this library in one of your projects, add it in this list. :sparkles:
## License
See the [LICENSE](./LICENSE) file.
[KINDLY][license] © [Ionică Bizău][website]
[license]: http://ionicabizau.github.io/kindly-license/?author=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica@gmail.com%3E&year=2014
[website]: http://ionicabizau.net
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
[donate-now]: http://i.imgur.com/6cMbHOC.png
[contributing]: /CONTRIBUTING.md
[docs]: /DOCUMENTATION.md

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc