
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
lightlayer
Advanced tools
A simple responsive lightbox & dialog script.
jQuery LightLayer Plugin is a responsive lightbox & dialog script that fits well with any project on any screen. It provides great experience for users and it’s really quite simple to use. jQuery LightLayer Plugin gives control over many settings. Things like background color, background opacity, box position, open/close transitions and different abilities for closing are part of the options that users can manipulate by themselves. And no matter the content jQuery LightLayer Plugin will always have a proper behavior. It works fine with external websites, video players, maps. And if there is a long content jQuery LightLayer Plugin will use the native scrollbar without scrolling the page behind.
You can download the plugin as an archive.
Or you can grab it by using npm:
npm install lightlayer
Or you can grab it by using Bower:
bower install lightlayer
Include the script after the jQuery library (unless you package scripts otherwise):
<script src="/path/to/lightlayer.min.js"></script>
Also include the stylesheet for the plugin:
<link type="text/css" rel="stylesheet" href="/path/to/lightlayer.css">
$.lightlayer();
This is the most basic way to use jQuery LightLayer Plugin. By doing so the plugin will look for $('#popup') object, so if you're going to keep it simple, make sure you have that one in the DOM. If no such object, nothing will happen.
Of course, you can overwrite the default target by providing a custom one, so that you can use the jQuery LightLayer Plugin for more than one popup.
$.lightlayer({
object: $('#custom_popup')
});
Another way of calling LightLayer is right from a selector, as follows:
$('.popup').lightlayer();
If the selector returns more than one object, the first one will be used. Also, if the object doesn't have an ID, a system one will be given.
$.lightlayer({
backgroundColor: '#000000',
opacity: 0.3,
transition: 0.1,
position: 'middle',
escape: true,
cache: true
});
There are several properties for setting some features when initializing the LightLayer. Here's a list of them:
Determines the background color of the layer behind the opened popup.
Type: string
Default value: '#000000'
Acceptable values: only HEX colors, no matter with or without the # prefix
Determines the opacity of the layer behind the opened popup.
Type: number
Default value: 0.3
Acceptable values: any number between 0 & 1 (incl.)
Determines the fade in/out transition speed (in seconds) of opening/closing the LightLayer. If set to 0, it will show & hide instantly.
Type: number
Default value: 0.1
Determines the vertical position of the popup. 'Third' option will keep the popup in ⅓ from the top.
The popups are always horizontally centered.
Type: string
Default value: 'middle'
Acceptable values: 'top', 'third', 'middle'
Determines if the popup should have the ability to be closed in a regular way or just in a specific one.
If set to true, the user will be able to close the popup by clicking/tapping the X-button in the upper right corner and also outside of the popup, or by pressing Escape button from the keyboard (if on desktop).
Type: boolean
Default value: true
Determines if the selected popup should be cached for further calls of the same target or not.
Type: boolean
Default value: true
When you have an opened LightLayer, there are several methods that allows manipulation of its environment.
So let's suggest there is an invoked LightLayer.
$.lightlayer({
object: $('#custom_popup'),
opacity: 0.5,
transition: 0,
position: 'third'
});
After that initialization you are able to call the following methods:
Changes the background color of the layer behind the opened popup. For example:
$.lightlayer().backgroundColor('FFFFFF');
Changes the opacity of the layer behind the opened popup. For example:
$.lightlayer().opacity(1);
Changes the vertical position of the popup. For example:
$.lightlayer().position('top');
Turns on/off the ability of a popup to be closed in a regular way or just in a specific one. For example:
$.lightlayer().escape(false);
Changes more than one option by passing an object with parameters. For example:
$.lightlayer().change({
backgroundColor: '#FFFFFF',
opacity: 1,
position: 'top',
escape: false
});
Exits from LightLayer. For example:
$.lightlayer().exit();
Besides the object and all options, there аre few callback functions that can be also passed to the LightLayer. Here's a list of them:
Triggers right before showing a popup.
$.lightlayer({
onOpen: function( e, popup ) {
// do something
}
});
Triggers right after hiding a popup.
$.lightlayer({
onClose: function( e, popup ) {
// do something
}
});
Triggers when changing the background color of the layer behind the opened popup.
$.lightlayer({
onChangeBackgroundColor: function( e, data ) {
// do something
}
});
Triggers when changing the opacity of the layer behind the opened popup.
$.lightlayer({
onChangeOpacity: function( e, data ) {
// do something
}
});
Triggers when changing the vertical position of the popup.
$.lightlayer({
onChangePosition: function( e, data ) {
// do something
}
});
Triggers when changing the escape ability.
$.lightlayer({
onChangeEscape: function( e, data ) {
// do something
}
});
Triggers when changing multiple settings.
$.lightlayer({
onChangeSettings: function( e, data ) {
// do something
}
});
Copyright © 2015 Martin Metodiev. Licensed under the MIT license. See here for more details.
FAQs
A simple responsive lightbox & dialog script
The npm package lightlayer receives a total of 0 weekly downloads. As such, lightlayer popularity was classified as not popular.
We found that lightlayer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.