javascript - Display image with actual sizes onclick - Stack Overflow

Before posting here i was testing over 30 or so Jquery image plugins to make my images appear full widt

Before posting here i was testing over 30 or so Jquery image plugins to make my images appear full width when clicked on.

the structure of the HTML is as follows:

<div class="whatever">
   <img id="noonecares" src="pff"></img>
</div>

and not

<a href=".."><img ></img></a>

I'm not talking about zooming in the photos but displaying the whole image onclick instead I'm looking for a Jquery solution preferably.

The solutions that i've been looking into are: zoomfancy easyzoom ajaxzoom ...

Thank y'all

Before posting here i was testing over 30 or so Jquery image plugins to make my images appear full width when clicked on.

the structure of the HTML is as follows:

<div class="whatever">
   <img id="noonecares" src="pff"></img>
</div>

and not

<a href=".."><img ></img></a>

I'm not talking about zooming in the photos but displaying the whole image onclick instead I'm looking for a Jquery solution preferably.

The solutions that i've been looking into are: zoomfancy easyzoom ajaxzoom ...

Thank y'all

Share Improve this question edited Aug 1, 2014 at 17:24 user1578720 asked Aug 1, 2014 at 17:18 user1578720user1578720 173 silver badges8 bronze badges 2
  • you mean in a new browser window – Ehsan Sajjad Commented Aug 1, 2014 at 17:22
  • in a responsive lightbox-like popup window – user1578720 Commented Aug 1, 2014 at 18:06
Add a ment  | 

3 Answers 3

Reset to default 2

If you just want a simple inline image expander then jQuery's toggleClass() is perfect for that. You shrink the images to a fixed size with CSS and then toggle it with a click.

DEMO

Something like

<div>
<img src="http://t1.gstatic./images?q=tbn:ANd9GcRvA_rqizvEgVJhJwLbpgMz7CgGwnjW5BlXHrBNzRwRXsq7O3Gi" />
</div>

script

$("div").on("click", function() {
    window.open($("img").attr("src"), "_blank", "menubar=1,resizable=1"); 
});

?

jsfiddle: http://jsfiddle/chrisbenseler/6GW6M/

This is my approach.

<div class="whatever">
   <img id="noonecares" src="http://imagizer.imageshack.us/v2/100x75q90/21/0ss1.jpg"></img>
</div>

Script

$('.whatever').on('click','#noonecares', function(){
    window.open($(this).attr('src'));
});

JSfiddle: http://jsfiddle/hFp6z/

UPDATE: If you want a plugin to zoom full size, then you can check fancybox or lightbox.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745426494a4627201.html

相关推荐

  • javascript - Display image with actual sizes onclick - Stack Overflow

    Before posting here i was testing over 30 or so Jquery image plugins to make my images appear full widt

    4小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信