2013-07-27 2 views
0

나는 prettyphoto js를 사용합니다.
표준 스크립트입니다 :PrettyPhoto 해시 링크

function setHashtag(){ 
    if(typeof theRel == 'undefined') return; 
    location.hash = theRel+'/'+rel_index+'/'; 
}; 

내가 그것을 변경하는 경우 :

function setHashtag(){ 
    if(typeof theRel == 'undefined') return; 
    location.hash = theRel+'='+rel_index; 
}; 

아이디 나던 작동합니다. 왜? 분명히

,이 같은 URL을 사용하는 경우 -

http://mysite.ru/video/twd.php#id/1/ 작동하고 모달 확인 열립니다. 하지만이 같은 링크를 열려고 할 때 http://mysite.ru/video/twd.php#id=1 nothenig happen ... 페이지 만로드합니다.

+0

오류가 있습니까? – putvande

+0

nope. '/'및 '='와 함께 작동합니다. 하지만이 링크를 (예 : twitter에서) '/'링크를 사용하면 오른쪽으로 모달 창이 열리지 만 '='는 아무 것도 발생하지 않습니다. 나는 희망을 가지고 있습니다. –

답변

0
hashIndex = getHashtag(); 
hashRel = hashIndex; 
hashIndex = hashIndex.substring(hashIndex.indexOf('=')+1,hashIndex.length); 
hashRel = hashRel.substring(0,hashRel.indexOf('=')); 

hashtag = (url.indexOf('?id') !== -1) ? decodeURI(url.substring(url.indexOf('?id')+1,url.length)) : false; 

location.hash = theRel + '=' + rel_index; 
history.pushState(0, 0, location.hash.replace('#','?'));