如何制作信息图"广泛"在Wordpress中

时间:2015-08-29 03:55:15

标签: php css wordpress

对于有这方面经验的人来说,这只是一个简单的问题。我正在为我的博客设计一个信息图,并注意到其他人可以通过点击按钮将信息图转到全宽模板。

以下是一个例子:

https://blog.kissmetrics.com/science-of-brands-on-instagram/

如果单击信息图,而不是直接转到图像页面,则会加载标题并将模板更改为全宽。我注意到URL查询转到了?wide = 1。

这是Wordpress中的插件还是内置函数?任何帮助将不胜感激:-)

1 个答案:

答案 0 :(得分:1)

很难说这是一个插件还是模板只是自然地显示这样的点击图像,但我想我可能会考虑做一个javascript而不是。这样,在放大和图像时,您不会离开页面。像这样:

演示: http://jsfiddle.net/8w0ay8xs/

<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<style>
.mycol  {
    width: 500px;
    border: 1px solid #000;
}
.myimg  {
    width: 500px;
}
.allwide    {
    position: absolute;
    text-align: center;
    margin: 30px auto;
    left: 10px;
    right: 10px;
    display: inline-block;
    width: 90%;
    float:left;
    box-shadow: 0px 0px 30px rgba(0,0,0,0.4);
    border: 10px solid #FFF;
    min-width: 700px;
}
</style>
<div class="mycol">
<h1>Infographic: The Science of Brands on Instagram</h1>
<p>No other social platform provides an experience as incredibly focused and engaging as Instagram. With just a bit of creativity and thoughtful measuring, you can make some Insta-magic for your brand. In this infographic, discover the trends behind the big-brand Instagram experience and learn how you can catapult your company to new heights.</p>

<p>Click on the infographic below to view a larger image:</p>
<img src="http://www.jpeg.org/images/jpeg-home.jpg" class="myimg" />
</div>
<script>
jQuery(document).ready(function() {
    jQuery(".myimg").click(function() {
        jQuery(this).toggleClass("allwide");
    });
});
</script>