javascript - Fancybox - How to load an image from a url? -


i wonder how can create lightbox loads image in page urls of links

here code not work:

   $("a.picture").click(function() {          $.fancybox({             'padding'           : 0,             'overlayshow'   : false,             'transitionin'  : 'elastic',             'transitionout' : 'elastic',             'titleposition' : 'over',             'type' : 'image',             'titleformat'   : function(title, currentarray,  currentindex, currentopts) {              return '<span id="fancybox-title-over">' + (currentindex +  1) + ' / ' + currentarray.length + (title.length ? ' &nbsp; ' +  title : '') + '</span>';             }          });          return false;      });  

and html code

<a class="picture" href="http://localhost/test/my_page.html" title="picture page">link</a>

thanks!

the script have above assumes have html this:

<a class="picture" href="images/picture.jpg">open image</a> 

then should add script option href like

$("a.picture").click(function() {          $.fancybox({             'padding'           : 0,             'overlayshow'   : false,             'href': this.href, //<--like            // etc.... 

that option provide url fancybox load image.

note: asking questions ok , glad help, @ofir commented should provide feedback , accept correct answers provided others people feel motivated out in future.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -