Change fixed heading on scrolling 600px - Responsive
Hey there! I've fixed a heading text for my image gallery and after scrolling some pictures, I want the heading text to get changed. I've done this in JavaScript but it is not responsive... i.e, after scrolling 600px on PC, heading text gets changed but I want the same change to be done in a responsive way...i.e, at 600px in PC and 2000px in phone view. Can anyone help me out please. This is my JS code.....I want $('#text').html to get changed at 2000px in phone view and at 600px in PC view $(document).ready(function(){ var scroll_pos = 0; $(document).scroll(function() { scroll_pos = $(this).scrollTop(); if(scroll_pos > 600) { $('#text').html('Guard of Honour'); } else { $('#text').html('Drills'); } }); });