Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
jquery.yalb
Advanced tools
Readme
Yet Another LightBox
Easy to use, out of the box
If you are looking for a plain-javascript-version take a look at yalb!
Download the production version or the development version. Or run
bower install jquery.yalb
Include yalb after jquery in your web page:
<link rel="stylesheet" href="dist/yalb.min.css">
<script src="jquery.js"></script>
<script src="dist/jquery.yalb.min.js"></script>
<script>
jQuery(function($) {
var images = [
'img1.jpg',
'img2.jpg',
'img3.jpg',
'img4.jpg',
'img5.jpg'
]
$.yalb(images);
// or just
$('img').yalb();
// for other possibilities to call yalb see below
});
</script>
array
filled with Strings
var images = [
'img1.jpg',
'img2.jpg',
'img3.jpg',
'img4.jpg',
'img5.jpg'
];
$.yalb(images);
NodeList
or Array
of Nodes
var images = document.getElementsByTagName('img');
$.yalb(images);
// or
var links = document.getElementsByTagName('a');
$.yalb(links, {src: 'href'});
// or any other node with an attribute containing the path
// e.g. <span data-image="/path/to/image.jpg"
$.yalb(span, {src: 'data-image'});
jQuery
-Collection
var images = $('img');
$.yalb(images);
// or of course
$('img').yalb();
// or same as above
selfmade object containing the path
var images = [
{
foo: 'bar'
path: 'path/to/image.jpg'
},
{
// and so on
}
];
$.yalb(images, {src: 'path'});
// or even
var images = [
{
path: {
'to': {
'image': 'path/to/image.jpg'
}
}
},
{
// and so on
}
];
$.yalb(images, {src: 'path.to.image'});
The following options can be passed when calling yalb:
src
( default:'src'
), Attribute where the path is located.current
( default:0
), The image which is presented when opening yalbclass
( default:'yalb'
), The class passed to the html-container of yalbloop
( default:true
), If true, images will be repeated when hitting the first/last imageopen
( default:true
), If true, yalb opens when calledwidth
( default:0
), max-with of the Yalb-windowheight
( default:0
), max-height of the Yalb-windowYou can change the default values for the whole page by assigning to $.yalb.defaults
$.yalb.defaults = {
src: 'src',
current: 0,
'class': 'yalb',
loop: true,
open: true,
width: 0,
height: 0
};
You can control the behavior of yalb with the following methods
$.yalb.open()
- Opens yalb when still not open$.yalb.close0()
- Close yalb; same as hitting the close-button$.yalb.next()
- Next Image; same as hitting the next-button$.yalb.prev()
- Previous Image; same as hitting the prev-button$.yalb.show(index)
- Changes to the image on position index
$.yalb.on()
- Binds handler to an event (take a look at the Events-section)$.yalb.off()
- Removes Handler (Caution!! - This will also remove handlers used by yalb itself when you don't explicitely specify a listener which should be removed or when you don't use namespaced events)$.yalb.get()
- Gets the jQuery-instance of the container on which all events are triggeredYou can listen to the following Events when using yalb:
change
- When the image has changedopen
- When open is called (per Method or per yalb-call with open:true
)close
- When close-button is pressednext
- When next-button is pressedprev
- When prev-button is pressedshow
- When show is calledYou can style yalb to your own needs. An example-style is shipped with the code. You can change it to your needs. Every button used is styled with css-only. No icon is needed. Even the loading-animation is css.
Take a look into the css-file - it's selfexplaining!
FAQs
Yet Another LighBox. Easy to use and out of the Box
The npm package jquery.yalb receives a total of 1 weekly downloads. As such, jquery.yalb popularity was classified as not popular.
We found that jquery.yalb demonstrated a not healthy version release cadence and project activity because the last version was released 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.