无法使模态框出现使用JQuery [英] Unable to make modal box appear using JQuery
问题描述
使用JQuery我试图获得一个模态框,以打开图像上的点击后。我可以使用硬链接打开框,但不是当用户点击图像时。我已尝试使用.show,但这不似乎是正确的?
Using JQuery I'm trying to get a modal box to open after a click is made on an image. 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?
这里的例子 http://jsfiddle.net/63VeU/13/
下面的代码结构使用.go等必须保留
The below code structure using .go etc must remain as thats how the images are identified that they can be clicked on.
我知道这是一个菜鸟的问题,但是我找不到我需要的解析器。
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;
});
});
推荐答案
这里你有一个工作演示。我注意到你做了一些额外的东西,如 SaveMyBadge();
这样更新了小提琴。
Sure. Here you got a working demo. I noticed you do some additional stuff like 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;
});
这篇关于无法使模态框出现使用JQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!