Pen Settings

↑ Insert the most common viewport meta tag

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.


              <h3>Pure Javascript</h3>
<div class="zoomPic"></div>
<button class='zoom'>Zoom</button>
<button class='pause'>Pause</button>
<button class='zoomout'>Zoom Out</button>

<div class='zoomPic'></div> 
<button class='zoom'>Zoom</button>
<button class='pause'>Pause</button>
<button class='zoomout'>Zoom Out</button>


              .zoomPic {
  margin: 30px;
  width: 300px;
  height: 180px;
  background-color: blue;
  background-image: url(;
  background-position:50% 50%;
  background-size: 300px 180px;
  -webkit-transition: all 2.5s ease-in-out;
  -moz-transition: all 2.5s ease-in-out;
  -ms-transition: all 2.5s ease-in-out;
  -o-transition: all 2.5s ease-in-out;
  transition: all 2.5s ease-in-out;
.zoomPic.zoom {
  background-size: 1200px 720px !important; 


              var zoomOne = document.getElementsByClassName('zoomPic')[0],
    zoomOneBGSize = window.getComputedStyle(zoomOne).getPropertyValue('background-size'),
    $zoomTwo = $('.zoomPic:eq(1)'),
    zoomTwoBGSize = $zoomTwo.css('background-size');

document.getElementsByClassName('zoom')[0].onclick = function() {
document.getElementsByClassName('pause')[0].onclick = function() {
    var computedStyle = window.getComputedStyle(zoomOne),
        backgroundSize = computedStyle.getPropertyValue('background-size'); = backgroundSize;
document.getElementsByClassName('zoomout')[0].onclick = function() {
  zoomOne.classList.remove('zoom'); = zoomOneBGSize;

$('.zoom:eq(1)').on('click', function() { 
$('.pause:eq(1)').on('click', function() {
    var backgroundSize = $zoomTwo.css("background-size");
    $zoomTwo.css({'background-size': backgroundSize});
$('.zoomout:eq(1)').on('click', function() {
  $zoomTwo.css('background-size', zoomTwoBGSize);
Loading ..................