[英]Content in nested tabs not displaying full 100% width
I have nested tabs set up but the contents inside the second set of tabs ( #tab-2-1
, #tab-2-2
, #tab-2-3
) aren't stretching to their full 100% width. 我已经设置了嵌套标签,但是第二组标签(
#tab-2-1
, #tab-2-2
, #tab-2-3
)中的内容并未拉伸到其全部100%宽度。 Is there something I missed? 有什么我想念的吗?
HTML HTML
<ul class="tabs">
<li><a href="#tab1">Bonus Episodes</a></li>
<li><a href="#tab2">Videos</a></li>
</ul>
<div id="tab1" class="tab_content">
<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/44386375%3Fsecret_token%3Ds-bi246&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false"></iframe>
</div>
<div id="tab2" class="tab_content">
<ul class="tabs">
<li><a href="#tab2-1">Foreally Stream</a></li>
<li><a href="#tab2-2">Ross</a></li>
<li><a href="#tab2-3">Jude</a></li>
</ul>
<div id="tab2-1" class="tab_content">
[videogallery id="video-stream"]
</div>
<div id="tab2-2" class="tab_content">
[videogallery id="ross"]
</div>
<div id="tab2-3" class="tab_content">
[videogallery id="jude"]
</div>
</div>
CSS CSS
.tab_content {
background:#000;
color:#fff;
max-width:500px;
padding:10px
}
.tabs li {
display:inline;
list-style:none
}
.tabs a {
background:#7c7c7c;
border-radius:5px 5px 0 0;
color:#dadada;
display:inline-block;
font-size:2em;
padding:10px 15px 8px;
text-decoration:none
}
.tabs a.active {
background:#e32d2d;
color:#fff
}
#tab2 ul.tabs a {
background:transparent;
color:#999;
padding:10px 10px 0 10px
}
#tab2 ul.tabs a.active {
color:#fff
}
JS JS
jQuery('ul.tabs').each(function(){
// For each set of tabs, we want to keep track of
// which tab is active and it's associated content
var $active, $content, $links = jQuery(this).find('a');
// If the location.hash matches one of the links, use that as the active tab.
// If no match is found, use the first link as the initial active tab.
$active = jQuery($links.filter('[href="'+location.hash+'"]')[0] || $links[0]);
$active.addClass('active');
$content = $($active[0].hash);
// Hide the remaining content
$links.not($active).each(function () {
jQuery(this.hash).hide();
});
// Bind the click event handler
jQuery(this).on('click', 'a', function(e){
// Make the old tab inactive.
$active.removeClass('active');
$content.hide();
// Update the variables with the new link and content
$active = jQuery(this);
$content = jQuery(this.hash);
// Make the tab active.
$active.addClass('active');
$content.show();
// Prevent the anchor's default click action
e.preventDefault();
});
});
In your CSS: 在您的CSS中:
.videogallery .sliderMain {
width: 100%!important;
}
The .videogallery .sliderMain
is being given an inline style with a width of 100px. 为
.videogallery .sliderMain
提供了内联样式,宽度为100px。
Whatever created the markup from the [videogallery] shortcode (WordPress plugin perhaps?) is giving it the 100px width. 不论是通过[videogallery]短代码(也许是WordPress插件?)创建了标记,还是为其赋予了100px的宽度。 You can either override this in your CSS (with the above) or you can investigate further how it is calculating the 100px by digging through the JS/CSS for the videogallery plugin.
您可以在CSS中(使用上面的代码)覆盖它,也可以通过为videogallery插件挖掘JS / CSS来进一步研究它如何计算100px。
Hope that helps. 希望能有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.