Skip to content

Instantly share code, notes, and snippets.

View travismillerweb's full-sized avatar

Travis Miller travismillerweb

View GitHub Profile
@travismillerweb
travismillerweb / sitcky-footer-zurb.js
Created March 31, 2014 12:50
JS - Sticky Footer Fix For Zurb Foundation 3
@travismillerweb
travismillerweb / cross-browser-placeholders.js
Created March 31, 2014 08:34
JS- Cross Browser Placeholder Tesr for Forms
/*
JS - Cross Browser Placeholder Text for Forms
Makes HTML5 Placeholder text work on all forms
Reference Link: http://scotch.io/quick-tips/js/making-html5-placeholder-input-fields-cross-browser-with-jquery
*/
@travismillerweb
travismillerweb / matchmedia.js
Created March 30, 2014 17:03
JS - Match Media Function
/*
JS - Media Match Function
Use JavaScript's matchMedia Method to detect the type of device you are using, and invoke/activate functions based on those criteria.
Reference Links:
http://davidwalsh.name/orientation-change
http://davidwalsh.name/device-state-detection-css-media-queries-javascript
http://www.slideshare.net/DavidKnight5/howto-match-media-25008199
@travismillerweb
travismillerweb / duplicate-copy-method.js
Created March 30, 2014 16:31
JS - Duplicate and Copy Element's Methods
/*
JS - Duplicate and Copy Element's Methods
Take a method associate with an existing HTML element and add it to another element.
Reference Link: https://forum.jquery.com/topic/how-do-i-copy-the-click-event-from-one-element-to-another.
Tip: Know how your mouseevents or other actions work, you may need to break down certain steps in order to get the functionality you require.
@travismillerweb
travismillerweb / line-on-sides.scss
Last active August 29, 2015 13:57
Sass - Line On SIdes Headers
/*
Sass - Line On Side Headers
Reference Link: http://css-tricks.com/line-on-sides-headers/
Implementation Example: <h1 class="fancy"><span>Title</span></h1>
*/
@travismillerweb
travismillerweb / .htaccess
Created March 6, 2014 20:38
Apache - Remove .php from File URL
## Remove .php from File URL
## Reference Link: http://stackoverflow.com/questions/15917258/remove-php-from-urls-with-htaccess
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
@travismillerweb
travismillerweb / snap-to-section.js
Created March 4, 2014 09:56
JS - Snap To Section
/*
JS - Snap To Section
Snaps elements to the section as users scroll
Reference Link: http://stackoverflow.com/questions/6800404/scrollable-panel-snap-to-elements-on-scroll
*/
@travismillerweb
travismillerweb / add-remove-rules.js
Created February 18, 2014 21:41
JS - Add and Remove Rules Directly to Stylesheets
/*
JS - Add and Remove Rules Directly to Stylesheets
Reference Site: http://davidwalsh.name/ways-css-javascript-interact
*/
function addCSSRule(sheet, selector, rules, index) {
if(sheet.insertRule) {
@travismillerweb
travismillerweb / style-before-after.js
Created February 18, 2014 21:40
JS - Style Before and After Elements
/*
JS - Style Before and After Elements
Reference Site: http://davidwalsh.name/ways-css-javascript-interact
*/
// Get the color value of .element:before
var color = window.getComputedStyle(
@travismillerweb
travismillerweb / section-scrolling.js
Created February 13, 2014 17:44
JS - Section Scrolling Ease
sectionScrolling: function () {
$('.specialized-practice-menu li a[href*=#]:not([href=#])').click(function(e) {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top -50
}, 500);