Sha256: 328dc956a439ed76927588aeb3ed9ff64365d1e0301395e3a408eea24a825474
Contents?: true
Size: 1.36 KB
Versions: 7
Compression:
Stored size: 1.36 KB
Contents
jQuery.widget('pageflow.autoHidePlayerControls', { attach: function(player) { var element = this.element; var options = this.options; var pageElement = this.options.pageElement; var target = this.options.target; var timeout; pageElement.on('mousemove', autoHideControls); $('body').on('keydown', autoHideControls); pageElement.find('.content').on('touchstart', autoHideControls); player.on('play', function() { autoHideControls(); }); player.on('pause', showControls); element.on('mouseenter', function() { target.addClass('is_control_bar_hovered'); }); element.on('mouseleave', function() { target.removeClass('is_control_bar_hovered'); }); function autoHideControls() { showControls(); if (!pageflow.browser.has('phone platform')) { clearTimeout(timeout); timeout = setTimeout(hideControls, 2000); } } function hideControls() { if (!player.paused()) { target.addClass('is_idle'); element.addClass('has_been_faded'); if (options.onHide) { options.onHide(); } } } function showControls() { target.removeClass('is_idle'); if (options.onShow) { options.onShow(); } } }, reset: function(options) { this.element .removeClass('has_been_faded'); } });
Version data entries
7 entries across 7 versions & 1 rubygems