#createElement(element,attribute,inner);
use:
createElement("tag","[attr:val][attr:val]",[element1,"some text",element2,element3,"or some text again :)"]);
basic:
#createElement(element,attribute,inner);
use:
createElement("tag","[attr:val][attr:val]",[element1,"some text",element2,element3,"or some text again :)"]);
basic:
#Vanilla JavaScript useful variables (almost jQuery)
Tests: JSBin
Test 1: 1 element (ID)
$('#hola').style.color = 'red';
Test 2: 2 elements (selector)
| var elem = document.querySelector('#video'); | |
| var fired = false; | |
| window.addEventListener('scroll', function(e){ | |
| if (document.body.scrollTop >= 300 && fired === false) { | |
| console.log('fire!'); | |
| fired = true; | |
| } | |
| }, true); |
| // JS Function expressed in Jade lang. | |
| - var randBetweenValues = function(min,max){ | |
| - return Math.floor(Math.random() * (max - min + 1) + min); | |
| - } | |
| // USE: | |
| p #{randBetweenValues(205,215)} | |
| // OUTPUT: | |
| <p>209</p> |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| // The Mixin: | |
| @mixin bp($type) { | |
| @if $type == small { | |
| @media (min-width: 24em) { @content; } | |
| } | |
| @else if $type == medium { | |
| @media (min-width: 46.8em) { @content; } | |
| } | |
| @else if $type == large { | |
| @media (min-width: 50em) { @content; } |
| // USE | |
| .font-face(Ubuntu-Regular, 'https://dl.dropbox.com/u/1220078/ubuntu-new/Ubuntu-Regular-webfont', 400, normal); | |
| .font-face(Ubuntu-Italic, 'https://dl.dropbox.com/u/1220078/ubuntu-new/Ubuntu-Regular-Italic-webfont', 400, italic); | |
| .font-face(Ubuntu-Bold, 'https://dl.dropbox.com/u/1220078/ubuntu-new/Ubuntu-Bold-webfont', 700, normal); | |
| .test { | |
| .font(Ubuntu-Regular, 1em, normal, normal); | |
| h1 { | |
| .font(Ubuntu-Bold, 1.7em, bold, normal); | |
| } |
| .focus, | |
| .blur { | |
| transition: 1s; | |
| } | |
| .focus #focus, | |
| .blur #blur { | |
| display: inline-block; | |
| } | |
| .focus #blur, | |
| .blur #focus { |
| $('#calendar').fullCalendar({ | |
| viewRender: function(currentView){ | |
| var minDate = moment(), | |
| maxDate = moment().add(2,'weeks'); | |
| // Past | |
| if (minDate >= currentView.start && minDate <= currentView.end) { | |
| $(".fc-prev-button").prop('disabled', true); | |
| $(".fc-prev-button").addClass('fc-state-disabled'); | |
| } | |
| else { |
| /** | |
| * Columns Equal Height | |
| * http://css-tricks.com/equal-height-blocks-in-rows/ | |
| * USE: equalHeight(elements); | |
| */ | |
| equalHeight = function(container){ | |
| var currentTallest = 0, | |
| currentRowStart = 0, | |
| rowDivs = new Array(), | |
| $el, |