rushdi
rushdi

Reputation: 221

Magnific popup not working properly

Magnific popup is working, but not the way I want it to.

Here is Plnkr.

Why is it not working? Here is the jQuery code:

$('.view').click(function() {
    $('.image-popup').magnificPopup({
        type: 'image',
        closeOnContentClick: true,
        mainClass: 'mfp-img-mobile',
        image: {
            verticalFit: true
        }
    });
});

Upvotes: 0

Views: 379

Answers (2)

ajarianaka
ajarianaka

Reputation: 38

Why don't you change your html to :

<div class="pic">
    <a  class="image-popup-fit-width" href="http://farm4.staticflickr.cm/3721/9207329484_ba28755ec4_o.jpg" title="This image fits only horizontally.">
    <img src="pictureLink" width="75" height="75">
  </a>
  <p><a href="http://farm4.staticflickr.com/3721/9207329484_ba28755ec4_o.jpg" class="image-popup-fit-width">Click to view</a></p>
  </div>

Upvotes: 1

Harsimran Singh
Harsimran Singh

Reputation: 16

The anchor tag needs to have image-popup-fit-width class rather image-popup.

<a  class="image-popup-fit-width" href="http://farm4.staticflickr.com/3721/9207329484_ba28755ec4_o.jpg" title="This image fits only horizontally.">
        <img src="http://farm4.staticflickr.com/3721/9207329484_ba28755ec4_o.jpg" width="75" height="75">
</a>

Upvotes: 0

Related Questions