[英]Unable to make modal box appear using JQuery
Using JQuery I'm trying to get a modal box to open after a click is made on an image. 使用JQuery,我试图在单击图像后打开一个模式框。 I can make the box open using a hard link, but not when the user clicks the image. 我可以使用硬链接打开此框,但是当用户单击图像时则不能打开。 I've tried using .show but this does'doesn't seem correct? 我尝试使用.show,但这似乎不正确吗?
Example fiddle here http://jsfiddle.net/63VeU/13/ 示例小提琴在这里http://jsfiddle.net/63VeU/13/
The below code structure using .go etc must remain as thats how the images are identified that they can be clicked on. 必须保留以下使用.go等的代码结构,这就是如何识别可单击图像的方式。
I know this is a rookie, question, but I'm unable to find the anser I need anywhere. 我知道这是一个菜鸟,但我无法在任何地方找到我需要的分析服务。
$(document).ready(function() {
$('.go img').css('cursor', 'pointer');
$('.go').on('click', 'img', function(e) {
$(this).width(100).height(100).appendTo('#modal-show');
$( "#modal-show" ).show( "slow", function() {
// Animation complete.
});
SaveMyBadge();
return false;
});
});
Sure. 当然。 Here you got a working demo. 在这里,您有一个正在运行的演示。 I noticed you do some additional stuff like SaveMyBadge();
我注意到您还做了其他一些事情,例如SaveMyBadge();
so updated the fiddle. 因此更新了小提琴。
<a href="#modal-show" title="Clicking this link shows the modal">
<img class="images BadgeImgOutline responsive-image" src="http://kudosoo.com/GBadges/badge9.jpg" alt="badge-image" />
</a>
$(document).on('click', '.click-badge', function () {
//do other stuff if you need to
SaveMyBadge();
return false;
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.