From 727ba3fd587fc124c5f6e33658ef161a6f9b06ea Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Wed, 27 Mar 2019 12:34:11 +0100 Subject: [PATCH] UI Landing: Simplify javascript code for overlay. --- src/templates/projects/landing.pug | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/templates/projects/landing.pug b/src/templates/projects/landing.pug index 04737ca..06b2b93 100644 --- a/src/templates/projects/landing.pug +++ b/src/templates/projects/landing.pug @@ -150,12 +150,19 @@ link(href="{{ url_for('static_cloud', filename='assets/css/project-main.css') }} | {% block footer_scripts %} script. - // Click anywhere in the page to hide the overlay - function hideOverlay() { - $('#page-overlay.video').removeClass('active'); - $('#page-overlay.video .video-embed').html(''); + function showOverlay(html_content) { + $('#page-overlay') + .addClass('active') + .html(html_content); } + function hideOverlay() { + $('#page-overlay') + .removeClass('active') + .html(''); + } + + //- Click anywhere in the page to hide the overlay. $(document).click(function () { hideOverlay(); }); @@ -170,9 +177,8 @@ script. e.preventDefault(); e.stopPropagation(); - $('#page-overlay').addClass('active'); var url = $(this).attr('href'); - $('#page-overlay').html('') + showOverlay(''); });