You could use LazyLoading too, just put the URL for the image in a data-src
attribute in the element <img/>
, then on click your anchor, copy the data there to the src
attribute.
Maybe your lightbox plugin offers an event or config option to put your handler, using jQuery I’d use something like this:
$('a.load-lightbox').click(function(e) {
e.preventDefault()
$('.lightbox img').each(function(img) {
var src = img.data('src')
img.src = src
})
})
Related Posts:
- Using Backbone with the WordPress AJAX API
- WP-AJAX vs WP REST API: What to use for requests to the website from outside?
- Including WordPress in RESTful API
- REST API endpoint for elasticpress autosuggest
- Gutenberg – how to correctly perform ajax request on backend
- AJAX request from Chrome Extension to WordPress Website
- WP REST API route request explain
- Confused on AJAX submit form through page template
- Solve cors problem using rest api or ajax
- Is there a hook to process a backbone restful PUT request inside wordpress?
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- How to add WP API and JS featured image attachment
- how to send Ajax request in wordpress backend
- Identical wp_rest nonce returned from rest_api
- How do I get reusable blocks via frontend REST API?
- Is there builtin way to use protected AJAX endpoint?
- rest_no_route custom route
- Test WordPress api with postman
- How do I query posts by a sub value with the API?
- merge wp rest api query to get posts per category does not work
- Ways to load admin-ajax faster without initializing all plugins?
- How to make a fetch() POST request to wordpress rest api?
- post values to custom post type which has advanced custom fields
- REST public POST giving 403 forbidden nginx
- Is it good practice to use REST API in wp-admin plugin page? [closed]
- 404 error custom post type rest api
- How to require files in a custom endpoint
- Create a post with REST API and adding a category
- Should I edit a user meta field with PUT, PATCH, or POST and WP::Editable
- How to trigger lost password email using REST API?
- how reduce fetch/XHR response time
- Custom WP rest api endpoint only working on non https?
- Why are the most recent posts not appearing in a fetch request, unless I’m logged in?
- How to submit a button automatically after every scheduled hours?
- How to cache json with wp-super cache
- AJAX request on the frontend always returns 0 if user is not admin
- Admin Notification after save_post, when ajax saving in gutenberg
- Cannot load admin-ajax.php. No access-control allow origin*
- Initialize JS with an ajax loaded ACF form
- WordPress Nonce Issue for Ajax Login and Logout
- How to modify wp_ajax function?
- Nonces and Ajax request to REST API and verification
- Vue.js + AJAX Shortcode
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- wp_ajax action is not running
- Display sub-taxonomies based on SELECTED parent-taxonomy
- WordPress AJAX calls not detecting language properly?
- AJAX issue – Uncaught SyntaxError when processing Zip File
- wp_verify_nonce doesn’t return true on server when it matches the nonce
- How do I set the url to make an ajax request for a html document?
- wp-admin AJAX with Fetch API is done without user
- Populating content dynamically via AJAX and Advanced Custom Fields [closed]
- Create Page With wp_insert_post() and AJAX
- Load ajax if is_home()
- wp_localize_script not working on ajax response
- SSO autologin WordPress + Ajax
- How to handle 400 status in Ajax [duplicate]
- Ajax with plugins returns 0
- Ajax comment form submit on frontpage alerts success but no insertion
- Wp mail does not work when Ajaxed to
- Exposing data using a custom WordPress API
- Use WP admin AJAX url to hide API key
- 400 Bad Request when sending XHR from React.js to admin-ajax.php
- Making POST request with AJAX returns a 400 error (without jQuery)
- Load image src through Ajax by ID?
- Using get_theme_mod in php ajax form doesn’t work
- PHP session when called wp_ajax_nopriv
- What exactly does ‘authenticated’ mean for wp_ajax_nopriv?
- Use AJAX in a WordPress Plugin to Get Data From Custom Database?
- How to use Jeditable plugin with admin-ajax.php?
- Ajax mousedown call getting “cancelled” when clicking link
- WordPress Ajax Not Firing
- Get uploaded attachment width & height and attachment ID after upload them
- Disabling ajax code that does a POST request that ends in a 400 error code
- Refresh checkout fields on add to cart with order bump
- Add Server Side validation in Ajax mail form
- How to prevent my external API call from being called by anyone but me (my site)
- get a bad request 400 on my ajax-admin.php file
- Registration form AJAX check for existing username (simple version)
- How to check Ajax request only when i opened the Notifications list?
- All WordPress AJAX calls always return 0
- Syntax error on query_vars while handling with Jquery
- Want to send ajax request in wordpress to a custom file in plugin
- How to send the checkbox value to email
- Class called in template, AJAX not registering
- Same query in category.php and in function.php, but different result
- AJAX Call in Plugin Returns More than JSON
- Ajax take too long to return code
- problem when adding wp_editor with ajax [duplicate]
- Get wp-load.php PATH with wp_localize_script and JavaScript for plugin
- Ajax Form seems to post, but does not return
- Ajax request to admin-ajax.php and window.location.href
- Objects and get_post_meta() gives me 1 string for latitude and longitude
- Memberpress isn’t cooperating with WooCommerce
- where does my function output from load-* go?
- WordPress ajax requst returns zero
- wp_editor() in content that was loaded with ajax [duplicate]
- WordPress blocking polling request when signed into Admin
- Send button using own contact form [closed]
- wordpress ajax bad request 400