C
C
colddave2016-10-23 23:28:29
JavaScript
colddave, 2016-10-23 23:28:29

Why doesn't the script work in Safari?

$(window).scroll(function() {
  var st = $(this).scrollTop();
  var c = $('.food-menu__wrapper').offset().top;
  var d = st-c-100;
  $("#parallOne").css({
    "transform":"translatey("+(st-800)/5+"px"
  });
  $("#parallTwo").css({
    "transform":"translatey("+(st-800)/10+"px"
  });
  if(d>0){
    $(".food-menu__big-item-part--1").css({
      "transform":"translatey("+d+"px"
    });		
    $(".food-menu__big-item-part--2").css({
      "transform":"translatey("+d+"px"
    });		
    $(".food-menu__big-item-part--3").css({
      "transform":"translatey("+d+"px"
    });	
    $(".food-menu__big-item-part--4").css({
      "transform":"translatey("+d+"px"
    });	
    $(".food-menu__big-item-part--5").css({
      "transform":"translatey("+d+"px"
    });	
    $(".food-menu__big-item-part--6").css({
    "transform":"translatey("+d+"px"
    });	
    $(".food-menu__big-item-part--7").css({
    "transform":"translatey("+d+"px"
    });	
  } 
  if(d>=259){
    $(".food-menu__big-item-part--1").css({
      "transform":"translatey(259px"
    });		
  }
  if(d>=224){
    $(".food-menu__big-item-part--2").css({
      "transform":"translatey(224px"
    });	
    $(".food-menu__big-item-part p").css({
      "opacity":"0"
    });	
  } else{
    $(".food-menu__big-item-part p").css({
      "opacity":"1"
    });		
  }
  if(d>=216){
    $(".food-menu__big-item-part--3").css({
      "transform":"translatey(216px"
    });		
  }
  if(d>=187){
    $(".food-menu__big-item-part--4").css({
      "transform":"translatey(187px"
    });		
  }
  if(d>=155){
    $(".food-menu__big-item-part--5").css({
      "transform":"translatey(155px"
    });		
  }
  if(d>=106){
    $(".food-menu__big-item-part--6").css({
      "transform":"translatey(106px"
    });		
  }
  if(d>=69){
    $(".food-menu__big-item-part--7").css({
      "transform":"translatey(69px"
    });		
  }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-10-24
@colddave

Perhaps you have an error in your code?
Not worth the parenthesis for closing?

$(".food-menu__big-item-part--1").css({
  "transform":"translatey(259px"
});

It should be like this:
$(".food-menu__big-item-part--1").css({
  "transform": "translateY(259px)"
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question