|
@@ -3,7 +3,7 @@ Bones Scripts File
|
|
|
Author: Eddie Machado
|
|
Author: Eddie Machado
|
|
|
|
|
|
|
|
This file should contain any js scripts you want to add to the site.
|
|
This file should contain any js scripts you want to add to the site.
|
|
|
-Instead of calling it in the header or throwing it inside wp-head()
|
|
|
|
|
|
|
+Instead of calling it in the header or throwing it inside wp_head()
|
|
|
this file will be called automatically in the footer so as not to
|
|
this file will be called automatically in the footer so as not to
|
|
|
slow the page load.
|
|
slow the page load.
|
|
|
|
|
|
|
@@ -12,7 +12,12 @@ slow the page load.
|
|
|
// as the page loads, call these scripts
|
|
// as the page loads, call these scripts
|
|
|
jQuery(document).ready(function($) {
|
|
jQuery(document).ready(function($) {
|
|
|
|
|
|
|
|
- /******** RESPONSIVE GOODNESS *********/
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ Responsive jQuery is a tricky thing.
|
|
|
|
|
+ There's a bunch of different ways to handle
|
|
|
|
|
+ it so, be sure to research and find the one
|
|
|
|
|
+ that works for you best.
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
/* getting viewport width */
|
|
/* getting viewport width */
|
|
|
var responsive_viewport = $(window).width();
|
|
var responsive_viewport = $(window).width();
|
|
@@ -49,92 +54,37 @@ jQuery(document).ready(function($) {
|
|
|
}); /* end of as page load scripts */
|
|
}); /* end of as page load scripts */
|
|
|
|
|
|
|
|
|
|
|
|
|
-// HTML5 Fallbacks for older browsers
|
|
|
|
|
-$(function() {
|
|
|
|
|
- // check placeholder browser support
|
|
|
|
|
- if (!Modernizr.input.placeholder) {
|
|
|
|
|
- // set placeholder values
|
|
|
|
|
- $(this).find('[placeholder]').each(function() {
|
|
|
|
|
- $(this).val( $(this).attr('placeholder') );
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // focus and blur of placeholders
|
|
|
|
|
- $('[placeholder]').focus(function() {
|
|
|
|
|
- if ($(this).val() === $(this).attr('placeholder')) {
|
|
|
|
|
- $(this).val('');
|
|
|
|
|
- $(this).removeClass('placeholder');
|
|
|
|
|
- }
|
|
|
|
|
- }).blur(function() {
|
|
|
|
|
- if ($(this).val() === '' || $(this).val() === $(this).attr('placeholder')) {
|
|
|
|
|
- $(this).val($(this).attr('placeholder'));
|
|
|
|
|
- $(this).addClass('placeholder');
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // remove placeholders on submit
|
|
|
|
|
- $('[placeholder]').closest('form').submit(function() {
|
|
|
|
|
- $(this).find('[placeholder]').each(function() {
|
|
|
|
|
- if ($(this).val() === $(this).attr('placeholder')) {
|
|
|
|
|
- $(this).val('');
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/*! A fix for the iOS orientationchange zoom bug.
|
|
/*! A fix for the iOS orientationchange zoom bug.
|
|
|
Script by @scottjehl, rebound by @wilto.
|
|
Script by @scottjehl, rebound by @wilto.
|
|
|
MIT License.
|
|
MIT License.
|
|
|
*/
|
|
*/
|
|
|
(function(w){
|
|
(function(w){
|
|
|
-
|
|
|
|
|
// This fix addresses an iOS bug, so return early if the UA claims it's something else.
|
|
// This fix addresses an iOS bug, so return early if the UA claims it's something else.
|
|
|
- if( !( /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ){
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if( !( /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ){ return; }
|
|
|
var doc = w.document;
|
|
var doc = w.document;
|
|
|
-
|
|
|
|
|
if( !doc.querySelector ){ return; }
|
|
if( !doc.querySelector ){ return; }
|
|
|
-
|
|
|
|
|
var meta = doc.querySelector( "meta[name=viewport]" ),
|
|
var meta = doc.querySelector( "meta[name=viewport]" ),
|
|
|
initialContent = meta && meta.getAttribute( "content" ),
|
|
initialContent = meta && meta.getAttribute( "content" ),
|
|
|
disabledZoom = initialContent + ",maximum-scale=1",
|
|
disabledZoom = initialContent + ",maximum-scale=1",
|
|
|
enabledZoom = initialContent + ",maximum-scale=10",
|
|
enabledZoom = initialContent + ",maximum-scale=10",
|
|
|
enabled = true,
|
|
enabled = true,
|
|
|
x, y, z, aig;
|
|
x, y, z, aig;
|
|
|
-
|
|
|
|
|
if( !meta ){ return; }
|
|
if( !meta ){ return; }
|
|
|
-
|
|
|
|
|
function restoreZoom(){
|
|
function restoreZoom(){
|
|
|
meta.setAttribute( "content", enabledZoom );
|
|
meta.setAttribute( "content", enabledZoom );
|
|
|
- enabled = true;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ enabled = true; }
|
|
|
function disableZoom(){
|
|
function disableZoom(){
|
|
|
meta.setAttribute( "content", disabledZoom );
|
|
meta.setAttribute( "content", disabledZoom );
|
|
|
- enabled = false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ enabled = false; }
|
|
|
function checkTilt( e ){
|
|
function checkTilt( e ){
|
|
|
aig = e.accelerationIncludingGravity;
|
|
aig = e.accelerationIncludingGravity;
|
|
|
x = Math.abs( aig.x );
|
|
x = Math.abs( aig.x );
|
|
|
y = Math.abs( aig.y );
|
|
y = Math.abs( aig.y );
|
|
|
z = Math.abs( aig.z );
|
|
z = Math.abs( aig.z );
|
|
|
-
|
|
|
|
|
// If portrait orientation and in one of the danger zones
|
|
// If portrait orientation and in one of the danger zones
|
|
|
if( !w.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ){
|
|
if( !w.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ){
|
|
|
- if( enabled ){
|
|
|
|
|
- disableZoom();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if( !enabled ){
|
|
|
|
|
- restoreZoom();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if( enabled ){ disableZoom(); } }
|
|
|
|
|
+ else if( !enabled ){ restoreZoom(); } }
|
|
|
w.addEventListener( "orientationchange", restoreZoom, false );
|
|
w.addEventListener( "orientationchange", restoreZoom, false );
|
|
|
w.addEventListener( "devicemotion", checkTilt, false );
|
|
w.addEventListener( "devicemotion", checkTilt, false );
|
|
|
-
|
|
|
|
|
})( this );
|
|
})( this );
|