Skip to content

Instantly share code, notes, and snippets.

View michaelwhyte's full-sized avatar

Michael Whyte michaelwhyte

View GitHub Profile
@michaelwhyte
michaelwhyte / enter-fullscreen.js
Last active August 29, 2015 14:06
Code for entering fullscreen mode using the HTML5 fullscreen API
var fullscreenAvailable = false;
var btn01 = document.getElementById('btn-01');
// Test to see if
// full-screen is available
if(
document.fullscreenEnabled ||
document.webkitFullscreenEnabled ||
document.mozFullScreenEnabled ||
document.msFullscreenEnabled
@michaelwhyte
michaelwhyte / exit-fullscreen.js
Last active August 29, 2015 14:06
Code for exiting fullscreen mode using the HTML5 fullscreen API
var btn02 = document.getElementById('btn-02');
// Exit full-screen mode when btn02
// is clicked
btn02.addEventListener('click', function(){
exitFullscreen();
}, false);
element.requestFullscreen();
:-ms-fullscreen {
width: auto;
height: auto;
margin: auto;
}
<div class="img-02">
<img src="birds-on-jericho-beach.jpg" width="320" height="320" alt="" />
</div>
var img02 = document.querySelector('.img-02');
img01.addEventListener('click', function(){
if(fullscreenAvailable){
launchFullscreen(img01);
}else{
alert('Sorry, fullscreen not available...');
}
.img-02:-webkit-full-screen img {
display: block;
margin: 0; /* overide pre-existing margin styles */
}
.img-02:-moz-full-screen img {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
@michaelwhyte
michaelwhyte / .gitignore
Last active November 12, 2024 22:54
Starter Git ignore file for basic web development...
# OS generated files #
######################
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
@michaelwhyte
michaelwhyte / sr-only-class.css
Last active November 20, 2018 20:20
Screen Reader Only Class from Bootstrap
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
@michaelwhyte
michaelwhyte / frame-based-animation.scss
Created January 25, 2018 07:05 — forked from robweychert/frame-based-animation.md
A simple Sass function for frame-based CSS animation
// If you have experience with animation in other media, CSS
// animation’s percentage-based keyframe syntax can feel pretty
// alien, especially if you want to be very precise about timing.
// This Sass function lets you forget about percentages and
// express keyframes in terms of actual frames:
@function f($frame) {
@return percentage( $frame / $totalframes )
}