使用Wordpress Divi主题。我有一个自定义代码块来为选项卡式内容创建一些选项卡。
选项卡大部分工作正常,但选项卡中的图像库会被拉伸,直到浏览器调整一点。似乎有些javascript没有进入或者某些东西......?转到此处并单击选项卡以查看我的意思:
以下是标签:
function openCategory(evt, categoryName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the link that opened the tab
document.getElementById(categoryName).style.display = "block";
evt.currentTarget.className += " active";
}
&#13;
/* Style the list */
ul.tab {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
/* Float the list items side by side */
ul.tab li {float: left;}
/* Style the links inside the list items */
ul.tab li a {
display: inline-block;
color: black;
text-align: center;
padding: 14px 16px;
text-decoration: none;
transition: 0.3s;
font-size: 17px;
}
/* Change background color of links on hover */
ul.tab li a:hover {background-color: #ddd;}
/* Create an active/current tablink class */
ul.tab li a:focus, .active {background-color: #ccc;}
/* Style the tab content */
.tabcontent {
display: none;
padding: 6px 12px;
border: 1px solid #ccc;
border-top: none;
}
&#13;
<ul class="tab">
<li><a href="#" class="tablinks" onclick="openCategory(event, 'Sleek')">Sleek</a></li>
<li><a href="#" class="tablinks" onclick="openCategory(event, 'Soft')">Soft</a></li>
<li><a href="#" class="tablinks" onclick="openCategory(event, 'Contemporary')">Contemporary</a></li>
<li><a href="#" class="tablinks" onclick="openCategory(event, 'Traditional')">Traditional</a></li>
</ul>
<div id="Sleek" class="tabcontent">
<h3>Sleek</h3>
<p>[showmodule id="26937"]</p>
</div>
<div id="Soft" class="tabcontent">
<h3>Soft</h3>
<p>[showmodule id="26935"]</p>
</div>
<div id="Contemporary" class="tabcontent">
<h3>Contemporary</h3>
<p>[showmodule id="#"]</p>
</div>
<div id="Traditional" class="tabcontent">
<h3>Traditional</h3>
<p>[showmodule id="#"]</p>
</div>
&#13;
您可以在此处查看此行为:http://devstone.05creative.com/portfolio-test 单击前两个选项卡中的一个,然后稍微调整浏览器的大小。
帮助!
由于