1

I'm trying to create a Lightbox for Image.

You can see Perfectly working demo of this code here https://jsfiddle.net/hibbard_eu/zwk954Ln/

It's working fine for me except it's not showing the cross symbol to get back to previous page.

Here's the code:

<a href="http://saccc567.com/Shows/2014/SACCC_Show/100_0000-Banner_01.JPG"  
 data-lightbox="gallery-1"
 data-title="<a class='add' href='#' data-id='#1'>Add/edit caption</a> 
              <span class='divider'>|</span>
              <span class='caption'>A banner with some cars</span>"
              id="1">
  <img src="http://saccc567.com/Shows/2014/SACCC_Show/Thumbs/100_0000-Banner_01.JPG">
</a>

<script src="http://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>

<script type="text/javascript">
$("#lightbox").on("click", "a.add", function(){
var new_caption = prompt("Enter a new caption");
if(new_caption){
   var parent_id = $(this).data("id"),
       img_title = $(parent_id).data("title"),
       new_caption_tag = "<span class='caption'>" + new_caption + "</span>";

   $(parent_id).attr("data-title", img_title.replace(/<span class='caption'>.*<\/span>/, new_caption_tag));
   $(this).next().next().text(new_caption);
}
});
</script>

How can I show the cross sign to return back?

Or is there any better example for this on jsfiddle?

William-H-M
  • 1,050
  • 1
  • 13
  • 19

0 Answers0