Horizontal Scroll

1

Boys, I have this doubt. I have a jquery that works well on a mac, but on windows it gives me problems.

To leave it in context ... I have a horizontal scroll that when I scroll it passes images and everything, once it finishes it allows to go down inside the site, but it is not like that when I see it on a windows PC, this does not takes the scroll well and only goes down.

My question is that if I can let my horizontal slider work well on both types of pc?

Here I leave the script:

var cDataIndex = 1; // first page index
var maxIndex = document.querySelectorAll('.contenedor').length; // max index
var isOnScrolling = false;

var fnGoTo = function(goToPrev){
  if((goToPrev && cDataIndex <= 1) || (!goToPrev && cDataIndex >= maxIndex)) return; // there isn't another container

  isOnScrolling = true;

  document.querySelector('[data-index="' + cDataIndex + '"]').classList = 'contenedor animated ' + (!goToPrev ? 'slideOutLeft' : 'slideOutRight');

  cDataIndex += goToPrev ? -1 : 1;

  document.querySelector('[data-index="' + cDataIndex + '"]').classList = 'contenedor main animated ' + (goToPrev ? 'slideInLeft' : 'slideInRight'); // hide current container

  setTimeout(function(){
    isOnScrolling = false;
  }, 1000)
}

var MouseWheelHandler = function(e){
  if(!isOnScrolling) {
    fnGoTo(e.wheelDelta > 0);
  }
}

//bind mouse wheel event
document.addEventListener("mousewheel", MouseWheelHandler, false);
//  FIN SCRIPT SLIDER VERTICAL

Your contribution would be very helpful. Thank you!

    
asked by Marco Gallardo Manríquez 11.12.2017 в 17:12
source

0 answers