Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function(){
- function resizeForm(){
- var width = (window.innerWidth > 0) ? window.innerWidth : document.documentElement.clientWidth;
- if(width > 1024){
- // Click Top, Bottom, Left & Right events
- function printMousePos(event) {
- if (event.target.nodeName == 'A') return;
- var windowWidth = $(window).width(),
- windowHeight = $(window).height(),
- clickedX = event.clientX,
- clickedY = event.clientY,
- xCenter = Math.round(windowWidth * .5),
- yCenter = Math.round(windowHeight * .5),
- yTop = Math.round(windowHeight * .33),
- yBottom = Math.round(windowHeight * .66)
- ;
- // to top
- if (clickedY <= yTop) {
- $.fn.fullpage.moveSectionUp();
- }
- // to bottom
- else if (clickedY >= yBottom) {
- $.fn.fullpage.moveSectionDown();
- }
- // to left
- else if (clickedX < xCenter) {
- // Create a new jQuery.Event object with specified event properties.
- var leftkey = jQuery.Event("keydown", { keyCode: 37 });
- // trigger an artificial keydown event with keyCode 64
- //jQuery("body").trigger( leftkey );
- $('.bx-prev').trigger( leftkey );
- return false;
- }
- // to right
- else {
- // Create a new jQuery.Event object with specified event properties.
- var rightkey = jQuery.Event("keydown", { keyCode: 39 });
- $('.bx-next').trigger( rightkey );
- return false;
- }
- }
- document.addEventListener("click", printMousePos);
- // Change cursor on hover position
- function printMouseHov(event) {
- if (event.target.nodeName == 'A') return;
- var windowWidthHov = $(window).width(),
- windowHeightHov = $(window).height(),
- clickedXHov = event.clientX,
- clickedYHov = event.clientY,
- xCenterHov = Math.round(windowWidthHov * .5),
- yCenterHov = Math.round(windowHeightHov * .5),
- yTopHov = Math.round(windowHeightHov * .33),
- yBottomHov = Math.round(windowHeightHov * .66)
- ;
- // to top
- if (clickedYHov <= yTopHov) {
- //$("body").css({'cursor': 'url(https://www.theline.be/wp-content/uploads/2018/04/top.png), default'});
- $( "#fullpage" ).addClass( 'to-top' );
- $( "#fullpage" ).removeClass( 'to-bottom' );
- $( "#fullpage" ).removeClass( 'to-left' );
- $( "#fullpage" ).removeClass( 'to-right' );
- }
- // to bottom
- else if (clickedYHov >= yBottomHov) {
- //$("body").css({'cursor': 'url(https://www.theline.be/wp-content/uploads/2018/04/bottom.png), default'});
- $( "#fullpage" ).addClass( 'to-bottom' );
- $( "#fullpage" ).removeClass( 'to-top' );
- $( "#fullpage" ).removeClass( 'to-left' );
- $( "#fullpage" ).removeClass( 'to-right' );
- }
- // to left
- else if (clickedXHov < xCenterHov) {
- //$("body").css({'cursor': 'url(https://www.theline.be/wp-content/uploads/2018/04/left.png), default'});
- $( "#fullpage" ).addClass( 'to-left' );
- $( "#fullpage" ).removeClass( 'to-bottom' );
- $( "#fullpage" ).removeClass( 'to-top' );
- $( "#fullpage" ).removeClass( 'to-right' );
- }
- // to right
- else {
- //$("body").css({'cursor': 'url(https://www.theline.be/wp-content/uploads/2018/04/right.png), default'});
- $( "#fullpage" ).addClass( 'to-right' );
- $( "#fullpage" ).removeClass( 'to-bottom' );
- $( "#fullpage" ).removeClass( 'to-left' );
- $( "#fullpage" ).removeClass( 'to-top' );
- }
- }
- document.addEventListener("mousemove", printMouseHov);
- } else {
- }
- }
- window.onresize = resizeForm;
- resizeForm();
Add Comment
Please, Sign In to add comment