Skip to content
Snippets Groups Projects

Issue #3443644: Fix eslint warnings

Files
5
+ 58
39
(function ($) {
Drupal.behaviors.splashifyBehavior.full_screen =
function (context, settings) {
var splash_height = $(window).height();
Drupal.behaviors.splashifyBehavior.full_screen = function (
context,
settings,
) {
const splashHeight = $(window).height();
$('#splashify', context).once('splashify_open').each(function () {
var $splash = $(this);
// Open the splash div.
function openSplash($splash) {
const $body = $('body');
$body.addClass('splash-active');
const originalHeight = $splash.attr('originalheight');
if (originalHeight) {
$body[0].style.marginTop = `${originalHeight}px`;
const splashWrapper = document.querySelector('.splash-wrapper');
if (splashWrapper) {
splashWrapper.style.height = `${originalHeight}px`;
}
}
window.scrollTo(0, 0);
}
$('#splashify', context)
.once('splashify_open')
.each(function () {
const $splash = $(this);
// Get the height of the div. Set it as a custom attribute.
// Update the height to 0 and then show the div.
$('body').css('margin-top', splash_height);
$splash.attr('originalheight', splash_height + 'px');
$splash.css('position', 'absolute');
$splash.css('display', 'block');
document.body.style.marginTop = splashHeight;
$splash.setAttribute('originalheight', `${splashHeight}px`);
$splash.style.position = 'absolute';
$splash.style.display = 'block';
// Open the splash.
openSplash($splash);
// Track scroll position to destroy splash
$(context).once('splashify_scroll').on('scroll.splash', function () {
var $object = $(this);
var scroll_position = $object.scrollTop();
if (scroll_position >= splash_height) {
$object.scrollTop(0);
// Destroy the splash div...they scrolled passed it.
var $body = $('body');
$body.removeClass('splash-active');
$body.css('margin-top', 0);
$('#splashify', context).css('height', 0);
$object.off('scroll.splash');
}
});
});
$(context)
.once('splashify_scroll')
.on('scroll.splash', function () {
const $object = $(this);
const scrollPosition = $object.scrollTop();
if (scrollPosition >= splashHeight) {
$object.scrollTop(0);
// Destroy the splash div, they scrolled passed it.
const $body = $('body');
$body.removeClass('splash-active');
$body[0].style.marginTop = '0';
// Open the splash div.
function openSplash($splash) {
var $body = $('body');
$body.addClass('splash-active');
$body.css('margin-top', $splash.attr('originalheight'));
$('.splash-wrapper').css('height', $splash.attr('originalheight'));
window.scrollTo(0, 0);
}
const splashify = document.getElementById('splashify');
if (splashify) {
splashify.style.height = '0';
}
// Close the splash div.
function closeSplash() {
var $body = $('body');
$body.removeClass('splash-active');
$body.css('margin-top', 0);
$('.splash-wrapper').css('height', 0);
}
$object.off('scroll.splash');
}
});
});
// Close the splash div.
function closeSplash() {
const $body = $('body');
$body.removeClass('splash-active');
$body[0].style.marginTop = '0';
document.querySelector('.splash-wrapper').style.height = '0';
}
};
})(jQuery);
Loading