javascript - Add lightbox effect to images automatically -


Is it possible to add a lightbox effect on each image that is embedded in this way

  & lt; Img class = "full-img" src = "/ blog / content / picture / 2014 / June / biking_hye 1.jpg" alt = "" & gt;  

this

  & lt; A href = "/ blog / content / images / 2014 / June / biking_hwy1.jpg" data-lightbox = "how -to-enable-lightbox-in-ghost" data-title = "this is my caption" & gt; & Lt; Img class = "full-img" src = "/ blog / content / images / 2014 / June / betting_highway 1.jpg" alt = "" title = "" & gt; & Lt; / A & gt;  

After the page has been successfully filled?

I want to enable it on Java Ceat with a ghost CMS installation. thank you in advanced!

You can javascript on each image in the page and then change the attributes as needed. . Not necessarily the best way (this is a server-side choice), but it can work. After you go to the pictures, you will need to reinstall the lightbox plug-in to recreate the page again.

  var img = jQuery ("img"); Img.each (function () {var element = jQuery (this); var a = jQuery ("& lt; a / & gt;", {href: element.attr ("src"), "data-lightbox": "Test"}); Element.wrap (a);}); You must add your own customized property, but you get this idea. 


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -