Skip to content

Instantly share code, notes, and snippets.

View alyssachk's full-sized avatar

Alyssa C. alyssachk

View GitHub Profile
@alyssachk
alyssachk / responsive-embed-bootstrap.html
Created September 24, 2016 17:02
Allow browsers to determine video or slideshow dimensions based on the width of their containing block by creating an intrinsic ratio that will properly scale on any device.
<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
@alyssachk
alyssachk / inline-embed-responsive-video.html
Last active September 24, 2016 16:52
Embed responsive video by editing HTML file only.
<p style="position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0;">
<iframe style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; border: 0 none;"
src="http://www.youtube.com/embed/D6Ac5JpCHmI" allowfullscreen></iframe></p>
@alyssachk
alyssachk / embed-responsive-video.html
Last active September 24, 2016 16:36
Embed responsive video in HTML.
<!--Embed YouTube Video-->
<div class="video-container">
<iframe src="http://www.youtube.com/embed/D6Ac5JpCHmI" width="560" height="315" allowfullscreen></iframe>
</div>
<!--Embed Vimeo Video-->
<div class="video-container">
<iframe src="https://player.vimeo.com/video/158050352" width="560" height="315" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
@alyssachk
alyssachk / embed-responsive-video.css
Created September 24, 2016 16:00
CSS for embed video responsively.
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
@alyssachk
alyssachk / back-to-top.js
Created September 11, 2016 06:38
Back to Top Button jQuery
<a href="#" class="back-to-top">回到頁首</a>
<script>
jQuery(document).ready(function() {
var offset = 220;
var duration = 500;
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.back-to-top').fadeIn(duration);
} else {
jQuery('.back-to-top').fadeOut(duration);
@alyssachk
alyssachk / back-to-top.css
Created September 11, 2016 06:28
Back to Top Button CSS
.back-to-top {
display:none;
position: fixed;
bottom: 2em;
right: 0px;
text-decoration: none;
color: #000000;
background-color: rgba(235, 235, 235, 0.80);
font-size: 12px;
padding: 1em;
@alyssachk
alyssachk / cwtexhei.css
Created September 11, 2016 05:28
cwTeXHei font (Chinese: 黑體) is derived from the cwTeX Traditional Chinese Type 1 fonts made by Tsong-Min Wu, Tsong-Huey Wu and Edward G.J. Lee.
/*
* cwTeXHei (Chinese-traditional) http://www.google.com/fonts/earlyaccess
*/
@font-face {
font-family: 'cwTeXHei';
font-style: normal;
font-weight: 500;
src: url(//fonts.gstatic.com/ea/cwtexhei/v3/cwTeXHei-zhonly.eot);
src: url(//fonts.gstatic.com/ea/cwtexhei/v3/cwTeXHei-zhonly.eot?#iefix) format('embedded-opentype'),
url(//fonts.gstatic.com/ea/cwtexhei/v3/cwTeXHei-zhonly.woff2) format('woff2'),
@alyssachk
alyssachk / cwtexming.css
Created September 11, 2016 05:27
cwTeXMing font (Chinese: 明體) is derived from the cwTeX Traditional Chinese Type 1 fonts made by Tsong-Min Wu, Tsong-Huey Wu and Edward G.J. Lee.
/*
* cwTeXMing (Chinese Traditional) http://www.google.com/fonts/earlyaccess
*/
@font-face {
font-family: 'cwTeXMing';
font-style: normal;
font-weight: 500;
src: url(//fonts.gstatic.com/ea/cwtexming/v3/cwTeXMing-zhonly.eot);
src: url(//fonts.gstatic.com/ea/cwtexming/v3/cwTeXMing-zhonly.eot?#iefix) format('embedded-opentype'),
url(//fonts.gstatic.com/ea/cwtexming/v3/cwTeXMing-zhonly.woff2) format('woff2'),
@alyssachk
alyssachk / cwtexfangsong.css
Created September 11, 2016 05:26
cwTeXFangSong font (Chinese: 仿宋體) is derived from the cwTeX Traditional Chinese Type 1 fonts made by Tsong-Min Wu, Tsong-Huey Wu and Edward G.J. Lee.
/*
* cwTeXFangSong (Chinese Traditional) http://www.google.com/fonts/earlyaccess
*/
@font-face {
font-family: 'cwTeXFangSong';
font-style: normal;
font-weight: 500;
src: url(//fonts.gstatic.com/ea/cwtexfangsong/v3/cwTeXFangSong-zhonly.eot);
src: url(//fonts.gstatic.com/ea/cwtexfangsong/v3/cwTeXFangSong-zhonly.eot?#iefix) format('embedded-opentype'),
url(//fonts.gstatic.com/ea/cwtexfangsong/v3/cwTeXFangSong-zhonly.woff2) format('woff2'),
@alyssachk
alyssachk / cwtexyen.css
Created September 11, 2016 05:25
cwTeXYen font (Chinese: 圓體) is derived from the cwTeX Traditional Chinese Type 1 fonts made by Tsong-Min Wu, Tsong-Huey Wu and Edward G.J. Lee.
/*
* cwTeXYen (Chinese Traditional) http://www.google.com/fonts/earlyaccess
*/
@font-face {
font-family: 'cwTeXYen';
font-style: normal;
font-weight: 500;
src: url(//fonts.gstatic.com/ea/cwtexyen/v3/cwTeXYen-zhonly.eot);
src: url(//fonts.gstatic.com/ea/cwtexyen/v3/cwTeXYen-zhonly.eot?#iefix) format('embedded-opentype'),
url(//fonts.gstatic.com/ea/cwtexyen/v3/cwTeXYen-zhonly.woff2) format('woff2'),