繁体   English   中英

更改嵌入式推文的最大宽度

[英]changing the max-width of the embedded tweet

我正在尝试将twitter feed嵌入我的angular 2应用程序中,但是对设置在250到550像素之间的tweet设置了最大宽度限制( https://dev.twitter.com/web/embedded-tweets/parameters )。 有没有一种方法可以在不使用j-query的情况下将最大宽度更改为100%。 它基本上应该覆盖整个灰色背景。 先感谢您。

 !function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + '://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js, fjs); } } (document, 'script', 'twitter-wjs'); 
 .SandboxRoot { width: 100% !important; } div { background-color: grey; width: 100% !important; max-width: 100% !important; min-width: 100% !important; } .EmbeddedTweet{ width: 100% !important; max-width: 100% !important; min-width: 100% !important; } div twitterwidget { width: 100% !important; max-width: 100% !important; min-width: 100% !important; } 
 <div> <div> <blockquote class="twitter-tweet" data-lang="en"> <a href="https://twitter.com/Interior/status/463440424141459456?ref_src=twsrc%5Etfw"></a> </blockquote> </div> </div> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> 

是的,有可能。

使用twitterwidget::shadow选择器定位

 ! function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + '://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js, fjs); } } (document, 'script', 'twitter-wjs'); 
 .SandboxRoot { width: 100% !important; } div { background-color: grey; width: 100% !important; max-width: 100% !important; min-width: 100% !important; } twitterwidget::shadow .EmbeddedTweet { width: 100% !important; max-width: 100% !important; min-width: 100% !important; } div twitterwidget { width: 100% !important; max-width: 100% !important; min-width: 100% !important; } 
 <div> <div> <blockquote class="twitter-tweet" data-lang="en"> <a href="https://twitter.com/Interior/status/463440424141459456?ref_src=twsrc%5Etfw"></a> </blockquote> </div> </div> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM