Guest User

Untitled

a guest
Apr 25th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. // PARENT WINDOW
  2. (function () {
  3. function scrollWindow(evt) {
  4. var message;
  5.  
  6. if (evt.origin !== "iframe_URL_HERE" ) {
  7. message = "Action cannnot be performed";
  8. } else {
  9. var x = evt.data.xAxis || 0;
  10. var y = evt.data.yAxis || 0;
  11. window.scrollTo(x,y);
  12. }
  13. }
  14.  
  15. if (window.addEventListener) {
  16. // For standards-compliant web browsers
  17. window.addEventListener("message", scrollWindow, false);
  18. } else {
  19. window.attachEvent("onmessage", scrollWindow);
  20. }
  21. }());
Add Comment
Please, Sign In to add comment