Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 23/11/2024 Black Friday 2024

    BIG SALE, 30% discount for all our extensions. Use BF24 coupon code. Hurry up the discount is valid till 3 December.

  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

How to get the Image Id
(1 viewing) (1) Guest
"ARI Fancy Lightbox" WordPress plugin
Go to bottomPage: 1
TOPIC: How to get the Image Id
#72182
How to get the Image Id 4 Months ago Karma: 0
Is it possible to get the image id of the currently displayed image in lightbox? Could be loaded anywhere in the DOM or an accessible JavaScript variable. I would search via the image url followed by _posts -> guid; however sometimes the guid is not accurate to the current image name in some situations. If there was a filter, JS code, or way to get the currently displayed Image Id I would be very happy.
Last Edit: 2024/08/22 22:24 By Josh.
The administrator has disabled public write access.
 
#72192
Re:How to get the Image Id 3 Months, 4 Weeks ago Karma: 760
Hello,

Do you mean image ID from WordPress database? If yes, the lightbox doesn't operate with IDs. It works with the generated HTML markup.

Regards,
ARI Soft
The administrator has disabled public write access.
 
#72195
Re:How to get the Image Id 3 Months, 3 Weeks ago Karma: 0
admin wrote:
Do you mean image ID from WordPress database?

Yes, the image id from the WordPress database. Regarding id in the HTML image code, you can see the raw id in the gallery DOM on the following page:
joshjourney.com/favorites

It is wrapped with a div class 'image-id' for each image. I can even make the image id load into the top div '.tiled-gallery-item' if that helps. I have full control of the DOM/outputs on the post (it's a custom theme I made). I'm skilled enough to perform basic JavaScript/PHP operations but struggle with being able to have things like image title/caption in the lightbox. If I had the id placed within the lightbox this would allow me to write a hashChange jQuery script that checks if int, send to php file, check in php if int, then load author info, publish date, and other data back into a custom box on each image. If I can get image DOM elements/attributes into lightbox I could even bypass the need of another php file.
Last Edit: 2024/08/28 02:46 By Josh.
The administrator has disabled public write access.
 
#72199
Re:How to get the Image Id 3 Months, 3 Weeks ago Karma: 760
The following JS code can be used to get ID of current slide:

Code:


jQuery.fancybox.getInstance().current.opts.$orig.find('[data-attachment-id]').attr('data-attachment-id')



Regards,
ARI Soft
The administrator has disabled public write access.
 
#72203
Re:How to get the Image Id 3 Months, 3 Weeks ago Karma: 0
For some reason I'm struggling to have it work with alerts, but I have gotten it to work. This comes greatly appreciated. Thank you.
The administrator has disabled public write access.
 
Go to topPage: 1