在OS X上的Safari 6中的主页上向左或向右移动DIV会产生文物



网站:http://www.laederach.com/chde/sortiment.html浏览器:OS X Lion上的Safari 6

在这里,您在页面中心有一个可滚动的内容。除了OS X上的Safari外,它在每个Web浏览器中都可以正常工作。左右滚动时,Safari不足以快速更新背景并创建白色文物(身体背景是白色)。

如何阻止Safari移动页面的背景?Chrome做对了。

那是在做魔术的代码:

    /*Slider at SortimentArea*/
function initSlider(){
     //$('#sortimentScrollbar').tinyscrollbar({ axis: 'x', size: 953 });
    //Scroll Drag
    var dragLimit = 1270;
    var scrollbarWidth = 945;
    var scrollbarThumbWith;
    var thumbPos;
    var thumbPosSave;
    thumbPos = $('.thumb').css("left");
    //thumbPosSave = $('.thumb').data('savePoint', thumbPos);
    //Calc size of scrollbar  
    if(scrollbarWidth > $('#sortimentScrollbar .overview').width()){
      $('.scrollbar .thumb').width(scrollbarWidth);  
    }else{
      $('.scrollbar .thumb').width( dragLimit * scrollbarWidth/$('#sortimentScrollbar .overview').width());     
      $('.thumb').css("left", 40);
    }  
  scrollbarThumbWidth = $('.scrollbar .thumb').width();
  //howAllImageInstant;

  //Set positions for scrollbar and sortiment if coming back from productpage
  setOldScrollbarAndSortimentPosition();
  if (($('.scrollbar .thumb').css("left").replace('px','')- -1*($('.scrollbar .thumb').css("width").replace('px',''))) > $('.scrollbar').css("width").replace('px',''))
    {
      //alert("bigger");
    }
    //Prevent Links from firing on move
    $('#sortimentScrollbar .overview a').click(function(){
      if($('#sortimentScrollbar .overview').data('down')){
        return false;
      }
  });
    //Set up the Moving Pane
    $('#sortimentScrollbar .overview').mousedown(function(event){
      event.preventDefault();
      $(this)
        .data('down', true)
        .data('x', event.clientX)
        .data('left', -1*$(this).position().left);
      return false;
    }).mouseup(function(event){
      event.preventDefault();
      $(this)
        .data('down', false);
    }).mousemove(function(event){      
      event.preventDefault();
      if($(this).data('down') == true){
        var pos = $(this).data('left') + $(this).data('x') - event.clientX;
        if(pos <= $(this).width()-dragLimit && pos >= 0){
          $(this).css('left', -1*(pos));
          $('.scrollbar .thumb').css('left', (scrollbarWidth/$('#sortimentScrollbar .overview').width())*pos);  
      savePositionsOfScrollingElements();
        }
      }
    }).mouseleave(function(event){
      $(this)
        .data('down', false);
    })
    .bind("touchstart", function(event){
      event.preventDefault();
      $(this)
        .data('down', true)
        .data('x', event.pageX)
        .data('left', -1*$(this).position().left);
      return false;
    }).bind('touchend', function(event){
      event.preventDefault();
      $(this)
        .data('down', false);
    }).bind('touchmove', function(event){
      event.preventDefault();
      if($(this).data('down') == true){
        var pos = $(this).data('left') + $(this).data('x') - event.pageX;
        if(pos <= $(this).width()-dragLimit && pos >= 0){
          $(this).css('left', -1*(pos));
          $('.scrollbar .thumb').css('left', (scrollbarWidth/$('#sortimentScrollbar .overview').width())*pos);          
          savePositionsOfScrollingElements();
        }
      }
    });
  //Set up the Scrollbar
  $(".scrollbar").click(function(event){
    window.setScrollbarViaClick = true;
    var x = event.pageX - $(this).offset().left;
    var windowWidth = $(window).width();
    var leftValueCorrention = 0;
  if (window.isSlide != true)
  {
    $newThumbLeftValue = 0
    if ((x-(leftValueCorrention +($(".thumb").css("width").replace('px','')/2))) < 0)
      {
      $newThumbLeftValue = 0;
      //$(".thumb").css("left",0);
        }
      else if((x-(leftValueCorrention +($(".thumb").css("width").replace('px','')/2)))-(-1*$(".thumb").css("width").replace('px','')) > $(".scrollbar").css("width").replace('px',''))
      {
      $newThumbLeftValue = $(".scrollbar").css("width").replace('px','')-$(".thumb").css("width").replace('px','')-10;
        //$(".thumb").css("left",$(".scrollbar").css("width").replace('px','')-$(".thumb").css("width").replace('px','')-10);
      }
      else
      {
      $newThumbLeftValue = x-(leftValueCorrention +($(".thumb").css("width").replace('px','')/2));
      //$(".thumb").css("left",x-(485+($(".thumb").css("width").replace('px','')/2)));   
     }
     $(".thumb").animate({
      left: $newThumbLeftValue
    }, 200, function(){});
    $newOverviewLeft = -1*($(".overview").css("width").replace('px','')/$(".scrollbar").css("width").replace('px','')*$newThumbLeftValue);
    $(".overview").animate({
      left: $newOverviewLeft
    }, 200, function(){savePositionsOfScrollingElements()});
    $(".overview").css("left",$newOverviewLeft);
    // $(".overview").css("left",-1*($(".overview").css("width").replace('px','')/$(".scrollbar").css("width").replace('px','')*$(".thumb").css("left").replace('px','')));
  }
    window.isSlide = false;
  });
  $('.scrollbar .thumb').mousedown(function(event){
    window.isSlide = true;
      event.preventDefault();
      $(this)
        .data('down', true)
        .data('x', event.clientX)
        .data('left', -1*$(this).position().left);
      return false;
    }).bind('touchstart', function(event){
      event.preventDefault();
      $(this)
        .data('down', true)
        .data('x', event.pageX)
        .data('left', -1*$(this).position().left);
      return false;
    }).bind('touchend', function(event){
      event.preventDefault();
      $('.scrollbar .thumb').data('down', false);
    }).bind('touchmove', function(event){
      event.preventDefault();
      if($('.scrollbar .thumb').data('down') == true){
        var posBar = -1*($('.scrollbar .thumb').data('left') + $('.scrollbar .thumb').data('x') - event.pageX);
        if(posBar <= scrollbarWidth-scrollbarThumbWidth && posBar >= 0){
          $('.scrollbar .thumb').css('left', posBar);
          var visPos = -1*(($('#sortimentScrollbar .overview').width()*posBar)/scrollbarWidth);
          $('#sortimentScrollbar .overview').css('left', visPos);
      savePositionsOfScrollingElements();
        }
      }
  });
    $('#bgDiv').mouseup(function(event){
      $('.scrollbar .thumb').data('down', false);
    }).mousemove(function(event){
      event.preventDefault();
      if($('.scrollbar .thumb').data('down') == true){
        var posBar = -1*($('.scrollbar .thumb').data('left') + $('.scrollbar .thumb').data('x') - event.clientX);
        if(posBar <= scrollbarWidth-scrollbarThumbWidth && posBar >= 0){
          $('.scrollbar .thumb').css('left', posBar);
          var visPos = -1*(($('#sortimentScrollbar .overview').width()*posBar)/scrollbarWidth);
          $('#sortimentScrollbar .overview').css('left', visPos);          
      savePositionsOfScrollingElements();
        }
      }
    });
  }

您最好检查页面上的HTML,在这里太多了。

预先感谢大家

我目前无法回答我的问题,但是我偶然发现了这个问题。请参阅下面的评论。

尝试以下:

background-position:fixed;

问题是我用来修复chrome bug的-webkit -transform,该错误导致某个时候不显示图像。此"黑客"使用了-webkit-transform: scale(1);

禁用此CSS属性在Safari中解决了不需要此黑客的问题。

最新更新