Documentation

Everything you can do with Beauter


Modal Images


Beauter can add modal images which are very useful in e-commerce and blogging related sites.

base
modal
object
-close
modal-content
caption

Click on the fading effect image to see it in a large modal box.

Blossom Garden, from Internet!
<img id="myImg" src="/img/pink.jpg" alt="Blossom Garden, from Internet!" width="300" height="200">

<!-- The Modal -->
<div id="myModal" class="modal">
  <span class="-close" id="imgclose">✖</span>
  <img class="modal-content" id="img01">
  <div id="caption"></div>
</div>

<script>
// Get the modal
var modal = document.getElementById('myModal');

// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.getElementById('myImg');
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption");
img.onclick = function(){
    modal.style.display = "block";
    modalImg.src = this.src;
    captionText.innerHTML = this.alt;
}

// Get the <span> element that closes the modal
var span = document.getElementById("imgclose");

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
    modal.style.display = "none";
}
</script>


News

  • New 'Examples' section coming with wonderful tutorials!
  • Adding animations and transitions effects soon.
  • 0.3 development started. Join us here.

Get Involved

Your contribution can make beauter more beautiful. Visit Github to collaborate.

Star Fork

Sitemap Designed with by Shubham Ramdeo
Follow @ramdeoshubham
outboxcraft logoOutboxcraft
© 2017