2012-10-31 3 views
1

나는 tumblr 포토 셋에 내 방식을 해킹하려고하고 있는데 나는 최대 700 디스플레이 크기에 대한 해결책을 찾은 것 같아. 의 src URL의 마지막 부분을 변경 iframe 대응의 폭을 변경할 수있는 방법이 있나요Tumblr Photoset

<iframe class="photoset" scrolling="no" frameborder="0" height="1048" width="700" style="border:0px; background-color:transparent; overflow:hidden;" src="http://www.georgefratila.ro/post/20314734048/photoset_iframe/esssk/tumblr_m1tp5634Si1qzc7t7/700/false"></iframe> 

과 :

의이가 {Photoset-700}에 의해 생성 된 정상은 iframe이라고 가정 해 봅시다 mantain 종횡비가 커지면? = "http://www.georgefratila.ro/post/20314734048/photoset_iframe/esssk/tumblr_m1tp5634Si1qzc7t7/700/false"의 마지막 부분을 변경 860 에 SRC = "700"변경이 값

폭 src/700/false// 860/false로

내가 사이트에서 jquery로 만든 것을 본 것 같지만 이름을 기억하지 못한다. 내 기록을 들여다 보겠다.

도움 주셔서 감사합니다.

 $('iframe.photoset').each(function() { 
     $(this).attr("width", function(index, old) { 
            return old.replace("700", "860"); 
      }); 
      $(this).attr("src", function(index, old) { 
            return old.replace("/700/false", "/860/false"); 
      }); 
}); 

내가 지금 가지고있는 유일한 문제는 iframe을 맞게 그것을 나던 규모, 높이입니다 :

Edit.1 나는 내가 거의 모든 정렬 생각합니다.

답변

1

이것은 많이 올 것 같습니다. Tumblr Photosets를 완벽하게 반응시키는 jQuery 플러그인을 개발했으며 컨테이너를 설정하는 모든 너비까지 올라갈 수 있습니다. https://github.com/PixelUnion/Extended-Tumblr-Photoset

더 많은 정보 (EXIF 데이터 포함)를 얻었으므로 콘텐츠를 완전히 제어 할 수 있으므로 iFrame 크기로 둘러 보는 것이 더 좋습니다.

0

나는 내 문제에 대한 해결책을 발견하고 여기있다 :

//This will change the source address and display the correct size. 

     $(".photoset").each(function() { 
    var newSrc = $(this).attr("src").replace('700','860'); 
    $(this).attr("src", newSrc);  
}); 
//This will get the new size of the iframe and resize the iframe holder accordingly. 

$(function(){ 
var iFrames = $('.photoset'); 
function iResize() { 
    for (var i = 0, j = iFrames.length; i < j; i++) { 
     iFrames[i].style.height = iFrames[i].contentWindow.document.body.offsetHeight + 'px';} 
    } 

    if ($.browser.safari || $.browser.opera) { 
     iFrames.load(function(){ 
      setTimeout(iResize, 0); 
     }); 

     for (var i = 0, j = iFrames.length; i < j; i++) { 
      var iSource = iFrames[i].src; 
      iFrames[i].src = ''; 
      iFrames[i].src = iSource; 
     } 
    } else { 
     iFrames.load(function() { 
      this.style.height = this.contentWindow.document.body.offsetHeight + 'px'; 
     }); 
    } 
}); 

당신은 최소화하거나 스크립트가 아래에 게시하시기 바랍니다 개선하는 방법에 대한 아이디어가 있다면. 즐기십시오