jquery - Lightbox plugin not working with PhoneGap images -


i using phonegap camera plugin , adding image page each picture selected. issue having is, when try implement lightbox on images, not desired results. if use same exact code on image not added via phonegap plugin, works perfectly. difference in code between 2 images src attribute. below code each:

normal image:

<a class="photo" href="img/server.png"><img src="server.png" alt="server" /></a> 

phonegap selected image:

<a class="photo" href="file:///storage/emulated/0/android/data/com.hdl.inspector/cache/1417822999785.jpg">     <img src="file:///storage/emulated/0/android/data/com.hdl.inspector/cache/1417822999785.jpg" alt="" /> </a> 

i discovered issue related photos being added after page load, rather having image path. initializing 'magnific popup' on page load following script

$('.photo').magnificpopup({       type: 'image',       gallery:{         enabled:true     }, }); 

here's code used add image page device:

function onsuccess(imageuri) {                                             var holder = document.getelementbyid('myimage');     var image = '<div class="edit-img" ><img class="remove" src="images/remove.png" />&nbsp;<a class="photo" href="' + imageuri + '"><span class="img-name">' + imageuri.lastindexof("/") + 1 + '</span>&nbsp;<img class="img-thumb" src="' + imageuri + '" /></a></div>'     $(holder).after(image); } 

the solution add magnific popup code inside function onsuccess(). final code looks this:

function onsuccess(imageuri) {                                             var holder = document.getelementbyid('myimage');     var image = '<div class="edit-img" ><img class="remove" src="images/remove.png" />&nbsp;<a class="photo" href="' + imageuri + '"><span class="img-name">' + imageuri.lastindexof("/") + 1 + '</span>&nbsp;<img class="img-thumb" src="' + imageuri + '" /></a></div>'     $(holder).after(image);      $('.photo').magnificpopup({         type: 'image',         gallery:{           enabled:true         },     }); } 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -