Team:UCL/Template:MainJS

From 2014.igem.org

(Difference between revisions)
(Created page with "// Avoid `console` errors in browsers that lack a console. (function() { var method; var noop = function () {}; var methods = [ 'assert', 'clear', 'count', 'd...")
Line 1: Line 1:
-
// Avoid `console` errors in browsers that lack a console.
+
( function( $ ) {
-
(function() {
+
-
    var method;
+
-
    var noop = function () {};
+
-
    var methods = [
+
-
        'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
+
-
        'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
+
-
        'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
+
-
        'timeStamp', 'trace', 'warn'
+
-
    ];
+
-
    var length = methods.length;
+
-
    var console = (window.console = window.console || {});
+
-
    while (length--) {
+
function enableSkrollr(){
-
        method = methods[length];
+
console.log('we are on desktop');
-
        // Only stub undefined methods.
+
// Enable Skroll only for non-touch devices
-
        if (!console[method]) {
+
//if(!Modernizr.touch){
-
            console[method] = noop;
+
var s = skrollr.init({
-
        }
+
            forceHeight: false
-
    }
+
        });
-
}());
+
        //}
-
// Place any jQuery/helper plugins in here.
+
}
 +
 
 +
function disableSkrollr(){
 +
console.log('we are on mobile');
 +
 
 +
// Destroy Skrollr
 +
var s = skrollr.init();
 +
s.destroy();
 +
}
 +
 
 +
enquire.register("screen and (min-width: 768px)", {
 +
    match : function() {
 +
        enableSkrollr();
 +
    }, 
 +
    unmatch : function() {
 +
        disableSkrollr();
 +
    }
 +
});
 +
 
 +
} )( jQuery );

Revision as of 10:22, 31 July 2014

( function( $ ) {

function enableSkrollr(){ console.log('we are on desktop');

// Enable Skroll only for non-touch devices //if(!Modernizr.touch){ var s = skrollr.init({ forceHeight: false });

       //}

}

function disableSkrollr(){ console.log('we are on mobile');

// Destroy Skrollr var s = skrollr.init(); s.destroy(); }

enquire.register("screen and (min-width: 768px)", { match : function() { enableSkrollr(); }, unmatch : function() { disableSkrollr(); } });

} )( jQuery );