2011-01-28 3 views
0

시작시 미끄러지는 여러 요소가있는 페이지가 있습니다. 나는 내 코드 종류의 적절한 창 계시되는 것을 작동javascript/jQuery location.href misses 표시

if (window.location.hash.length>0){ 

    var id = window.location.hash; 

    if (id.length==7){ //expected hash is 7 chars long (inC#) 

    console.log('Comment hash in url, finding link'); 

    $(id).parents('.details_wrapper').parent().show().find('.details_wrapper').addClass('open').slideDown('slow', function(){ //unhide and slidedown pane 
    window.location.href = id; 
    }); 
    } 
    } 

되는 URL에 해시를 기반으로 특정 창을 아래로 슬라이드 수 있기를 원하고, 그러나 window.location.href를 미끄러 져 창문이 앵커가있는 곳보다 더 약 800px 떨어진 곳에 페이지를 일관되게 배치하기 때문에 잘 작동하지 않는 것 같습니다. 가능한 측으로

는 I 개발자 콘솔 (사파리)로

window.location.href='#c83225'; 

입력으로서의 정 HREF를 확인할 수없는 것 같은 오류를 범 참고. Chrome 콘솔에서도 작동합니다.

답변

0

그렇게 할 수있는 또 다른 옵션은

window.location.hash = 'c83225'; 
+0

허가, 완벽하게 작동합니다. –

관련 문제