demo/inc/demo.js
function () {
            // Scroll or window resize
            $(window).on('resize scrollstop', _updateBoxes);

            // User entry
            $('input[type="number"]').on('keyup change click', events.onBoundaryChange); // 'click' is for spinners on input[number] control
            // Boundary toggle
            $showBoundsCheck.on('change', events.onBoundaryToggle);

            // Nudge controls
            // Only certain combinations of browsers/OSes allow capturing arrow key strokes, unfortunately
            // Windows: Firefox, Trident, Safari, Opera; Mac: Chrome, Safari, Opera; Not Firefox
            if ((navigator.oscpu && /Windows/.test(navigator.oscpu) && /Firefox|Trident|Safari|Presto/.test(navigator.userAgent)) || (/Macintosh/.test(navigator.userAgent) && /Chrome|Safari|Presto/.test(navigator.userAgent))) {
                $('#thresholds p').show();
                $('body').on('keydown', events.onNudge);
            }

            // Controls toggler
            $('#toggler').on('click', events.onControlsToggle);
        }
function () {
            // Scroll or window resize
            $(window).on('resize scrollstop', _updateBoxes);

            // User entry
            $('input[type="number"]').on('keyup change click', events.onBoundaryChange); // 'click' is for spinners on input[number] control
            // Boundary toggle
            $showBoundsCheck.on('change', events.onBoundaryToggle);

            // Nudge controls
            // Only certain combinations of browsers/OSes allow capturing arrow key strokes, unfortunately
            // Windows: Firefox, Trident, Safari, Opera; Mac: Chrome, Safari, Opera; Not Firefox
            if ((navigator.oscpu && /Windows/.test(navigator.oscpu) && /Firefox|Trident|Safari|Presto/.test(navigator.userAgent)) || (/Macintosh/.test(navigator.userAgent) && /Chrome|Safari|Presto/.test(navigator.userAgent))) {
                $('#thresholds p').show();
                $('body').on('keydown', events.onNudge);
            }

            // Controls toggler
            $('#toggler').on('click', events.onControlsToggle);
        }
function ( ) { // Scroll or window resize $ ( window ) . on ( 'resize scrollstop' , _updateBoxes ) ; // User entry $ ( 'input[type="number"]' ) . on ( 'keyup change click' , events . onBoundaryChange ) ; // 'click' is for spinners on input[number] control // Boundary toggle $showBoundsCheck . on ( 'change' , events . onBoundaryToggle ) ; // Nudge controls // Only certain combinations of browsers/OSes allow capturing arrow key strokes, unfortunately // Windows: Firefox, Trident, Safari, Opera; Mac: Chrome, Safari, Opera; Not Firefox if ( ( navigator . oscpu && / Windows / . test ( navigator . oscpu ) && / Firefox|Trident|Safari|Presto / . test ( navigator . userAgent ) ) || ( / Macintosh / . test ( navigator . userAgent ) && / Chrome|Safari|Presto / . test ( navigator . userAgent ) ) ) { $ ( '#thresholds p' ) . show ( ) ; $ ( 'body' ) . on ( 'keydown' , events . onNudge ) ; } // Controls toggler $ ( '#toggler' ) . on ( 'click' , events . onControlsToggle ) ; }
Setup event listeners
Setup event listeners