Skip to content

Instantly share code, notes, and snippets.

@e-river
e-river / form_active.js
Last active February 14, 2017 07:10
JavaScript for changing disabled to active button
(function(){
document.addEventListener('DOMContentLoaded', function(event) {
new ActiveForm().onEvent(event.target);
}, false);
})();
function ActiveForm() {
this.submit = document.getElementById('submit');
}
document.addEventListener("DOMContentLoaded", function(event) {
new ShowButton().load();
});
function ShowButton() {
this.btn = document.querySelectorAll('.class');
this.target = document.querySelectorAll('input[type="checkbox"]');
}
ShowButton.prototype.load = function() {
- var links = ['//www.google-analytics.com', '//accounts.google.com', '//apis.google.com', '//oauth.googleusercontent.com', '//ssl.gstatic.com', '//www.facebook.com', '//connect.facebook.net', '//static.ak.facebook.com', '//static.ak.fbcdn.net', '//s-static.ak.facebook.com', '//twitter.com', '//cdn.api.twitter.com', '//p.twitter.com', '//platform.twitter.com', '//b.st-hatena.com', '//cdn-ak.b.st-hatena.com', '//cdn.api.b.hatena.ne.jp']
each val in links
link(href='#{val}', rel='dns-prefetch')
@e-river
e-river / animation.scss
Last active August 29, 2015 14:13
Mixin for CSS Animation
// =========== [[CSS Animation]] ===========
// Keyframes
// Usage:
// @include keyframes(name) {
// 0% { selector { property: value; } }
// 100% { selector { property: value; } }
// }
@mixin keyframes($name) {
@-webkit-keyframes #{$name} {
@e-river
e-river / Speech-Synthesis-Demo.markdown
Created January 6, 2015 10:23
Speech Synthesis Demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@e-river
e-river / PointerEvents.js
Last active August 29, 2015 14:10
PointerEvents for less than IE10
$(function(){
var pointer = new PointerEvent();
pointer.load();
});
function PointerEvent(){
this.userAgent = window.navigator.userAgent.toLowerCase();
this.appVersion = window.navigator.appVersion.toLowerCase();
this.target = $('.cp-image');
this.pointer = $('.click-shield');
@e-river
e-river / _rollover.js
Last active June 8, 2016 05:47
jQuery Rollover for If there are any strings after the extension of image
/*
Usage:
HTML
<img class="js-rollover">
JS
require jQuery
http://jquery.com/download/
@e-river
e-river / _scrolltop_accordion.js
Created July 24, 2014 07:22
Accordion with scrolltop using Zepto.js
Zepto(function($){
var acc = new Accordion();
acc.init();
});
function Accordion(){
this.toggle = $('.mod-accordion_heading_toggle');
this.panel = $('.mod-accordion_panel');
}
Accordion.prototype.init = function(){
@e-river
e-river / _toggleClass.js
Last active August 29, 2015 14:01
Add / Remove class without using jQuery
/*
* This code is to add or remove class depends on the direction like Smartphone.
* The classname is 'isActive'.
*/
function toogleClass(){
this.node = document.querySelector(target);
}
toogleClass.prototype.init = function(){
var self = this;