dimanche 2 avril 2017

Rotate frame but not image

I want to rotate a frame but not the image inside it. Here is a JSFiddle that does the rotation but the image still moves. How can I keep the image stationary but move the frame only.

http://ift.tt/2nMHoFd

HTML:

<body>
<div class="center">
<div class="hexagon">
<div class="hexagon-in1">
<div class="hexagon-in2">

</div></div>
</div>
</div>

</body>

CSS:

.center{
  width: 200px;
  margin: auto;
  margin-top: -50px;
}
.hexagon{
  width: 200px;
  height: 400px;
  overflow: hidden;
  visibility: hidden;
  transform: rotate(120deg);
  cursor: pointer;
  -moz-transition: all 1s ease-in-out;
  -webkit-transition: all 1s ease-in-out;
  -o-transition: all 1s ease-in-out;
  transition: all 1s ease-in-out;
}
.hexagon-in1{
  overflow: hidden;
  width: 100%;
  height: 100%;
  transform: rotate(-60deg);
}
.hexagon-in2{
  width: 100%;
  height: 100%;
  visibility: visible;
  transform: rotate(-60deg);  
  background: url('http://ift.tt/2nQ1oIw');
  repeat: no-repeat;
  position: relative;

}  

.hexagon:hover{   
  -ms-transform: rotate(150deg); /* IE 9 */
   -webkit-transform: rotate(150deg); /* Chrome, Safari, Opera */
   transform: rotate(150deg);
}




Aucun commentaire:

Enregistrer un commentaire