I am using php.My link generate from controller.
$retailer["url"] like as 0125myimage.jpg
<a onClick="crop('.$retailer["url"].')" data-target="#styledModal3" href="#" class="fa fa-edit lupa"></a>
My javascript function
function crop(imgurl)
{
$('#preview').attr('src',imgurl);
$('div#styledModal3').load(function(){
$(this).modal({
keyboard:true,
backdrop:true
});
}).modal('show');
}
when I click in my link then modal not show.
.modal('show') calling before modal initialization $(this).modal({
function you used as argument in $('div#styledModal3').load( is just a success callback which fired only after load has completed. So initialization is called after you trying to show your modal.
Your code should looks like this
function crop(imgurl)
{
$('#preview').attr('src',imgurl);
$('div#styledModal3').load(function(){
$(this).modal({
keyboard:true,
backdrop:true,
show: true
});
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.