我正在使用 Foundation v5.5 并结合了两个 不同的 js 代码来创建一个可用的带有下拉手风琴的画布顶部导航。
However, when any of the dropdown accordions are selected, the text is being clipped because the .offcanvas-top class's height is being specified by the JS, and I simply don't know enough JS to add 100px to the height of .offcanvas-最佳。想法?
这是我的codepen和有问题的 js 的链接(我使用的是 WordPress,因此没有冲突):
//offcanvas dropdown accordions
var $s = jQuery.noConflict();
$s(".off-canvas-submenu").hide();
$s(".off-canvas-submenu-call").click(function() {
var icon = $s(this).parent().next(".off-canvas-submenu").is(':visible') ? '+' : '-';
$s(this).parent().next(".off-canvas-submenu").slideToggle('fast');
$s(this).find("span").text(icon);
});
//Offcanvas menu
(function(w){
var $z = jQuery.noConflict();
var $container = $z('.offcanvas-top'),
$cHeight = $z('.o-content').outerHeight();
$z(document).ready(function() {
buildCanvas();
});
function buildCanvas() {
$z('<a class="blue_bg button" href="#" id="trigger">Explore KSAS +</a>').appendTo($container);
$z('#trigger').bind('click', function(e) {
e.preventDefault();
var $this = $z(this);
$container.toggleClass('active');
if($container.hasClass('active')) {
$container.height($cHeight);
$this.text('Hide -');
} else {
$container.height(50);
$this.text('Explore KSAS +');
}
});
}
$z(window).resize(function() { //On Window resizeBy(
$cHeight = $z('.o-content').outerHeight();
console.log($cHeight);
});
})(this);
带有以下问题的屏幕截图: