alexemashev / lsb-lightbox Goto Github PK
View Code? Open in Web Editor NEWLightbox plugin for jQuery
License: MIT License
Lightbox plugin for jQuery
License: MIT License
I am looking for a way of launching the lightbox from javascript, as I have several places where the images are not linked
in the HTML but I still would like to launch the lightbox from javascript.
Is there a way of doing this ? Or do I need to add "hidden" links and trigger them ?
I tried being clever, however that didnt' work :D A temporary sollution would be to add a set of links in a hidden part og the page, now all I need to do is click them from javascript - as lsb-lighbox is already active on the links after page load.
<a href="URL_LINK_1" id="myid1" class="lsb-preview" data-lsb-group="tag">Image name 1</a>
<a href="URL_LINK_2" id="myid2" class="lsb-preview" data-lsb-group="tag">Image name 2</a>
At first neither og theese worked as simulating a link:
$('#myid1').click(); // doesnt work
$('#myid1').trigger('click'); // doesnt work
$('#myid1')[0].click(); // doesnt work
$('#myid1.lsb-preview').click(); // doesnt work
$('#myid1.lsb-preview').trigger('click'); // doesnt work
$('#myid1.lsb-preview')[0].click(); // doesnt work
It does seem that this one works though, I tried going through the entuire "click" manually and it does open:
var simMousedownEvent = new MouseEvent('mousedown', {
'view': window,'bubbles': true,'cancelable': true
});
$('#myid1.lsb-preview')[0].dispatchEvent(simMousedownEvent);
let simClick = new MouseEvent("click", {
bubbles: true,cancelable: true,view: window
});
$('#myid1.lsb-preview')[0].dispatchEvent(simClick);
var simMouseupEvent = new MouseEvent('mouseup', {
'view': window,'bubbles': true,'cancelable': true
});
$('#myid1.lsb-preview')[0].dispatchEvent(simMouseupEvent);
Are there any other ways of doing this ?
When switching to the next image it flashes the previous image then changes to the new image. Is there a way to stop this?
Hi,
Is there a built-in way to add custom buttons similar to download button.
If not it would be cool if that available in next releases.
Thanks
Indunil
Is there a way to set the download button to download a different URL?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.