2012-11-05 4 views
1

웹 사이트를 만듭니다. OS X의 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을, 여기에 너무 많이 될 것입니다.

사전

나는 순간에 내 질문에 대답 할 수없는에서 여러분 모두 감사하지만 난 사고하여 문제를 발견했다. 아래의 설명을 참조하십시오.

답변

0

문제는 내가이 언젠가는 이미지를 표시하지으로 이어질 크롬 버그를 해결하기 위해 사용했다 -webkit-변환했다. 이 "해킹"이 사용되었습니다 -webkit-transform: scale(1);

이 CSS 속성을 비활성화하면이 해킹이 필요하지 않은 Safari의 문제가 해결됩니다.

0

이 시도 :

background-position:fixed; 
+0

문제는 이미지를 표시하지 않는 Chrome 버그를 수정하는 데 사용 된 -webkit-transform이었습니다. 이 "hack"은'-webkit-transform : scale (1); '을 사용했습니다. 이 CSS 속성을 비활성화하면이 해킹이 필요하지 않은 Safari의 문제가 해결됩니다. –

관련 문제