Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
- <script>
- $(document).ready(function(){
- $(document).mousemove(function(e){
- $('img').css('left',e.pageX+"px");
- $('img').css('top',e.pageY+"px");
- });
- });
- function setBg(){
- var textBox = document.getElementById('tb').value;
- var myElement = document.querySelector("body");
- alert(textbox);
- myElement.style.backgroundImage = "url('" + textbox + "')";
- }
- </script>
- <style>
- img {
- position: absolute;
- transform: translate(-50%, -50%);
- }
- </style>
- </head>
- <body>
- <input id="tb" type="text" onkeypress="setBg()" />
- <img src="spotlight_bg.png" alt="" />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement