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. 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?

Example fiddle here 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.

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;
            });
        });

Problem courtesy of: Dano007

Solution

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;
});

Solution courtesy of: Dejan.S

我来评几句
登录后评论

已发表评论数()

相关站点

+订阅
热门文章