Created
May 28, 2018 12:44
-
-
Save divyanshu013/f8e7c4a2e8b9c91a2e7adead96a428fb to your computer and use it in GitHub Desktop.
CSS to make GIF play/pause
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.fix-nav { | |
// the container for static image and gif | |
.gif-container { | |
// the play icon | |
.fa-play { | |
color: #333; | |
font-size: 2.3rem; | |
position: absolute; | |
top: calc(50% - 2.5rem); | |
left: calc(50% - 2.5rem); | |
background: rgba(200,200,200,.6); | |
border-radius: 50%; | |
padding: 20px; | |
width: 60px; | |
height: 60px; | |
text-align: center; | |
line-height: 20px; | |
} | |
// the pause icon | |
.fa-pause { | |
display: none; | |
color: #333; | |
font-size: 2.3rem; | |
position: absolute; | |
top: calc(50% - 2.5rem); | |
left: calc(50% - 2.5rem); | |
padding: 20px; | |
width: 60px; | |
height: 60px; | |
text-align: center; | |
line-height: 20px; | |
} | |
.gif { | |
display: none; | |
} | |
&:hover { | |
.gif { | |
display: inline; | |
} | |
.static { | |
display: none; | |
} | |
.fa-play { | |
display: none; | |
} | |
.fa-pause { | |
display: inline; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment