Guest User

Untitled

a guest
May 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. jQuery(document).ready(function(){
  2. function resizeForm(){
  3. var width = (window.innerWidth > 0) ? window.innerWidth : document.documentElement.clientWidth;
  4. if(width > 1024){
  5.  
  6. // Click Top, Bottom, Left & Right events
  7. function printMousePos(event) {
  8. if (event.target.nodeName == 'A') return;
  9.  
  10. var windowWidth = $(window).width(),
  11. windowHeight = $(window).height(),
  12. clickedX = event.clientX,
  13. clickedY = event.clientY,
  14. xCenter = Math.round(windowWidth * .5),
  15. yCenter = Math.round(windowHeight * .5),
  16. yTop = Math.round(windowHeight * .33),
  17. yBottom = Math.round(windowHeight * .66)
  18. ;
  19.  
  20. // to top
  21. if (clickedY <= yTop) {
  22. $.fn.fullpage.moveSectionUp();
  23. }
  24.  
  25. // to bottom
  26. else if (clickedY >= yBottom) {
  27. $.fn.fullpage.moveSectionDown();
  28. }
  29.  
  30. // to left
  31. else if (clickedX < xCenter) {
  32. // Create a new jQuery.Event object with specified event properties.
  33. var leftkey = jQuery.Event("keydown", { keyCode: 37 });
  34.  
  35. // trigger an artificial keydown event with keyCode 64
  36. //jQuery("body").trigger( leftkey );
  37. $('.bx-prev').trigger( leftkey );
  38. return false;
  39. }
  40.  
  41. // to right
  42. else {
  43. // Create a new jQuery.Event object with specified event properties.
  44. var rightkey = jQuery.Event("keydown", { keyCode: 39 });
  45.  
  46. $('.bx-next').trigger( rightkey );
  47. return false;
  48. }
  49. }
  50.  
  51. document.addEventListener("click", printMousePos);
  52.  
  53. // Change cursor on hover position
  54. function printMouseHov(event) {
  55. if (event.target.nodeName == 'A') return;
  56.  
  57. var windowWidthHov = $(window).width(),
  58. windowHeightHov = $(window).height(),
  59. clickedXHov = event.clientX,
  60. clickedYHov = event.clientY,
  61. xCenterHov = Math.round(windowWidthHov * .5),
  62. yCenterHov = Math.round(windowHeightHov * .5),
  63. yTopHov = Math.round(windowHeightHov * .33),
  64. yBottomHov = Math.round(windowHeightHov * .66)
  65. ;
  66.  
  67. // to top
  68. if (clickedYHov <= yTopHov) {
  69. //$("body").css({'cursor': 'url(https://www.theline.be/wp-content/uploads/2018/04/top.png), default'});
  70. $( "#fullpage" ).addClass( 'to-top' );
  71. $( "#fullpage" ).removeClass( 'to-bottom' );
  72. $( "#fullpage" ).removeClass( 'to-left' );
  73. $( "#fullpage" ).removeClass( 'to-right' );
  74. }
  75.  
  76. // to bottom
  77. else if (clickedYHov >= yBottomHov) {
  78. //$("body").css({'cursor': 'url(https://www.theline.be/wp-content/uploads/2018/04/bottom.png), default'});
  79. $( "#fullpage" ).addClass( 'to-bottom' );
  80. $( "#fullpage" ).removeClass( 'to-top' );
  81. $( "#fullpage" ).removeClass( 'to-left' );
  82. $( "#fullpage" ).removeClass( 'to-right' );
  83. }
  84.  
  85. // to left
  86. else if (clickedXHov < xCenterHov) {
  87. //$("body").css({'cursor': 'url(https://www.theline.be/wp-content/uploads/2018/04/left.png), default'});
  88. $( "#fullpage" ).addClass( 'to-left' );
  89. $( "#fullpage" ).removeClass( 'to-bottom' );
  90. $( "#fullpage" ).removeClass( 'to-top' );
  91. $( "#fullpage" ).removeClass( 'to-right' );
  92. }
  93.  
  94. // to right
  95. else {
  96. //$("body").css({'cursor': 'url(https://www.theline.be/wp-content/uploads/2018/04/right.png), default'});
  97. $( "#fullpage" ).addClass( 'to-right' );
  98. $( "#fullpage" ).removeClass( 'to-bottom' );
  99. $( "#fullpage" ).removeClass( 'to-left' );
  100. $( "#fullpage" ).removeClass( 'to-top' );
  101. }
  102. }
  103.  
  104. document.addEventListener("mousemove", printMouseHov);
  105.  
  106. } else {
  107.  
  108. }
  109. }
  110. window.onresize = resizeForm;
  111. resizeForm();
Add Comment
Please, Sign In to add comment