Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- console.log('-= reject image lightbox');
- // Place this inside footer.php or into a JS file and use enqueue_script to load it in the more wp'ish way
- jQuery(function($){
- // this one creates a click function for every object that has the CSS class .popup-remove-image
- $(".popup-remove-image").click(function(e){
- // we disable the default click action of the clicked element
- e.preventDefault();
- // we save the data attributes of the clicked element into variables (not a must, you could call the directly)
- // Call the lightbox function and pass the arguments
- var reject_image;
- reject_image = $(this).data('reject-image');
- console.log(reject_image);
- lightbox_open(reject_image);
- });
- });
- window.document.onkeydown = function (e)
- {
- if (!e){
- e = event;
- }
- if (e.keyCode == 27){
- lightbox_close();
- }
- }
- function lightbox_open(){
- window.scrollTo(0,0);
- document.getElementById('light').style.display='block';
- document.getElementById('fade').style.display='block';
- }
- function lightbox_close(){
- document.getElementById('light').style.display='none';
- document.getElementById('fade').style.display='none';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement