How to mute a html5 video on scrollposition
问题 I want a html5 video being muted when the user scrolls to a div container (#scroll). Therefore I tried to use this code: $(document).ready(function(){ $(window).scroll(function(){ // Der Referenzwert der minimal Höhe var height = $('#scroll').offset(); // Die aktuelle Fensterposition (nach dem Scrollen) var current = $(window).scrollTop(); // Umgekehrte Logik if( current < height.top ){ $('video').setAttribute('muted'); } else { $('video').removeAttribute('muted'); } }); }); It's not working