【问题标题】:Tumblr photoset not responsive on the ipadTumblr 照片集在 ipad 上没有响应
【发布时间】:2014-02-23 07:28:23
【问题描述】:

我正在 tumblr 上开发一个自定义主题,我想让它具有响应性。

到目前为止,这是我想出的:couchspinach.tumblr.com

我的问题在于照片集。我正在使用 {photoset} 标签。 Tumblr docs 说:

{Photoset} 为响应式 Photoset 嵌入代码,该代码会缩小以适应容器(最大 700 像素宽)

我已经在几个浏览器中测试了布局,并且图像在除 ipad 之外的所有地方都可以正确调整大小!这是横向模式下的几个屏幕截图。第一张还行,第二张不行。它发生在 Safari 和 Chrome for ios 上。

我在网上没有找到太多,this 是唯一与问题相关但尚未解决的讨论。有谁知道它可能是什么?老实说,我不知道从哪里开始,我删除了 js 并没有什么不同,与 css 一样。我真的不知道该怎么办。任何帮助将不胜感激。

【问题讨论】:

    标签: javascript html ios css ipad


    【解决方案1】:

    宾果游戏!

    function resizePhotosets(){
        var parentWidth = document.body.querySelector('.html_photoset').offsetWidth; 
        var photosets = document.body.querySelectorAll('iframe.photoset');
        for(var i = 0; i < photosets.length; ++i){
            var photoset = photosets[i];
            photoset.width = parentWidth;
        }   
    }
    window.onload = resizePhotosets;
    window.onresize = resizePhotosets;
    
    // if using Infinite Scroll, call resizePhotosets() in it's callback function.
    

    https://gist.github.com/edadams/6678258

    非常感谢 Ed Adams。

    【讨论】:

      猜你喜欢
      • 2012-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-24
      相关资源
      最近更新 更多