Display Image on the same window with Javascript

2

As I describe in the title, what I try to do is that when you click on the icon of an image or a button you can display it on the same screen, just like in gmail it is done when you open a png or jpg and that when you click closes this.

I do not have much idea if it is done with javascript or how it is done so I ask for help if someone has the experience and knows a simple way about this.

Thank you in advance.

    
asked by JehTron 15.09.2018 в 00:28
source

1 answer

3

What you're looking for is Lightbox . It is the easiest way to do it, because you only need to add data-lightbox="TITULO" to a% tag <a> within which you can put your image

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.10.0/js/lightbox.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.10.0/css/lightbox.css" rel="stylesheet"/>

Clicke la imagen
<a href="https://78.media.tumblr.com/tumblr_m6v66lJ5K61r0taux.jpg" data-lightbox="smile">  <img height="42" width="42" src="https://78.media.tumblr.com/tumblr_m6v66lJ5K61r0taux.jpg"> </a>
    
answered by 15.09.2018 / 00:38
source