调整Twitter feed中的图片大小

时间:2018-11-14 10:55:42

标签: css twitter image-resizing

我可以缩小Twitter图片吗?我发现可以管理这种大小的课程

.MediaCard-media {
    width: 50% !important;
}

enter image description here

但不能应用我的样式(css仅在开发工具中覆盖,刷新页面后无结果)。

我也无法使用jQuery覆盖此样式,因为我无法在页面上获取这些对象:

jQuery(".MediaCard-media"); // 0 results

我使用Js片段加载twitter提要,以便与IE更好地兼容,如果需要,这里是代码:

<script type="text/javascript">
    function setUserAgent(window, userAgent) {
        // Works on Firefox, Chrome, Opera and IE9+
        if (navigator.__defineGetter__) {
            navigator.__defineGetter__('userAgent', function () {
                return userAgent;
            });
        } else if (Object.defineProperty) {
            Object.defineProperty(navigator, 'userAgent', {
                get: function () {
                    return userAgent;
                }
            });
        }
        // Works on Safari
        if (window.navigator.userAgent !== userAgent) {
            var userAgentProp = {
                get: function () {
                    return userAgent;
                }
            };
            try {
                Object.defineProperty(window.navigator, 'userAgent', userAgentProp);
            } catch (e) {
                window.navigator = Object.create(navigator, {
                    userAgent: userAgentProp
                });
            }
        }
    }

    try {
        setUserAgent(window,
            "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136"
        );
    } catch (e) {
        console.log(e);
    }
</script>
<!-- the Twitter a-element and the platform/js code goes here -->
<a class="twitter-timeline" data-tweet-limit="3" href="https://twitter.com/princecastlellc?ref_src=twsrc%5Etfw" data-chrome="nofooter transparent noheader">Tweets by princecastlellc</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

0 个答案:

没有答案