【问题标题】:Custom social share not opening in windows?自定义社交共享未在 Windows 中打开?
【发布时间】:2016-04-20 17:49:08
【问题描述】:

我创建了一个基于 this tutorial 的自定义社交分享模块,并试图了解为什么我的模块会在新标签页中全屏打开,但教程会在特定大小的新窗口中打开.

我希望我的以与本教程相同的方式打开,但我不确定。我知道有一种方法可以使用 JS 来定义窗口的大小,但这对我来说似乎不是最优雅的解决方案。

感谢您的帮助!

这是链接的基本 HTML:

<a class="fa fa-twitter share-base share-twitter" onclick="window.open('https://twitter.com/intent/tweet?text=the text')"></a>

这是我的module's prototype

【问题讨论】:

  • 赞这个window.open("", "", "width=200,height=100");
  • @AdamBuchananSmith 漂亮,非常感谢!

标签: javascript html css share


【解决方案1】:

只需像这样在window.open 中添加大小:

<a class="fa fa-twitter share-base share-twitter" onclick="window.open('https://twitter.com/intent/tweet?text=the text','','width=200,height=100')">test</a>

见小提琴:https://jsfiddle.net/1a8mpL75/1/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-14
    • 1970-01-01
    • 2016-03-14
    • 2021-05-26
    • 2016-07-20
    • 2015-08-12
    相关资源
    最近更新 更多