Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to change a layer on page scroll.
Posted

1 solution

Hi Santosh,

Please do the following:
Javascript code
C#
window.onscroll = function() {
           var layer = document.getElementById('dvDynamicPostion');
           layer.innerHTML += "\nscroll is at " + document.body.scrollLeft + " horizontally and " + document.body.scrollTop + " vertically.";
           layer.style.position = 'absolute';
           layer.style.top = '10px';   //Top position: You can change according your login
           layer.style.left = '10px';  //Left position: You can change according your login
       }

HTML code
XML
<div id="dvDynamicPostion">
       my position are always changed
   </div>



Please do let me know, if you have any doubt.

Please provide "Vote" if this would be helpful, and make "Accept Answer" if this would be correct answer.:rose:

Thanks,
Imdadhusen
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900