Video is played differently
-
Hey,
I have integrated a video into my website via html. With the help of Javascript, the video appears from a certain height and disappears again after a certain height. If I access the website via www.noals.de, everything works as it should. But when I go to Contacts, for example, and then back to the Home page via the Site title, the video is permanently there.
What could be the reason for this?My code:
Custom CSS for Desktop Version
#fixed-video { position: fixed; top: 55%; left: 62%; transform: translate(-50%, -50%); }Custom <head> content
<script> jQuery(document).ready(function($) { var $window = $(window), $fixedVideo = $('#fixed-video'), videoHeight = $fixedVideo.outerHeight(), showAtHeight = 500, hideAtHeight = 1850; $fixedVideo.hide(); $window.scroll(function() { var scrollTop = $window.scrollTop(); if (scrollTop > showAtHeight && scrollTop < hideAtHeight) { $fixedVideo.fadeIn(); } else { $fixedVideo.fadeOut(); } }); }); </script>Thanks in advance!
-
<script> var $fixedVideo; var showAtHeight = 500; var hideAtHeight = 1850; var videoHeight; jQuery(document).ready(function($) { $fixedVideo = jQuery('#fixed-video') videoHeight = $fixedVideo.outerHeight(); }); jQuery(window).on('scroll', (function() { var scrollTop = window.scrollY; if (scrollTop > showAtHeight && scrollTop < hideAtHeight) { $fixedVideo.fadeIn(); } else { $fixedVideo.fadeOut(); } }); jQuery(window).on('resize', function(){ videoHeight = $fixedVideo.outerHeight(); }); window.laytheme.on('newpageshown', function(){ $fixedVideo.hide(); }); </script>the reason it didnt work, jQuery(document).ready(function($) { is only triggered once!
read here: https://laytheme.com/documentation/custom-javascript.html -
<script> var $fixedVideo; var showAtHeight = 500; var hideAtHeight = 1850; var videoHeight; jQuery(document).ready(function($) { $fixedVideo = jQuery('#fixed-video') videoHeight = $fixedVideo.outerHeight(); }); jQuery(window).on('scroll', (function() { var scrollTop = window.scrollY; if (scrollTop > showAtHeight && scrollTop < hideAtHeight) { $fixedVideo.fadeIn(); } else { $fixedVideo.fadeOut(); } }); jQuery(window).on('resize', function(){ videoHeight = $fixedVideo.outerHeight(); }); window.laytheme.on('newpageshown', function(){ $fixedVideo.hide(); }); </script>the reason it didnt work, jQuery(document).ready(function($) { is only triggered once!
read here: https://laytheme.com/documentation/custom-javascript.html@arminunruh Thanks for your reply and sorry for my late reply.
I implemented the code you provided. The video is displayed the whole time. I think I understood the content within the link you provided but I cannot figure out a solution.
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login