您好,我正在使用wordpress,并且已经在主题的文件functions.php
中导入了引导程序,内容还可以,但是问题是当我最小化屏幕并单击打开正常的菜单时,显示内容一秒钟,然后内容消失,这是我用来导入必要内容的代码,以便该内容与菜单有关的所有其他内容都可以起作用:
function wpbootstrap_scripts_with_jquery()
{
// Register the script like this for a theme:
wp_enqueue_script( 'bootstrap-jquery', get_stylesheet_directory_uri() . '/jquery-3.3.1.js' );
wp_enqueue_script( 'bootstrap-script', get_template_directory_uri() . '/bootstrap.min.js', array(), true );
wp_enqueue_style( 'bootstrapstyle', get_template_directory_uri() . '/bootstrap.min.css' );
wp_enqueue_script( 'custom-script', get_stylesheet_directory_uri() . '/bootstrap.js', array( 'jquery' ) );
}
add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );
这是我在header.php
文件中使用的:
<nav class="navbar navbar-fixed-top navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Inicio</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Acerca De Nosotros</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Nuestros Servicios
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="#">Item</a>
<a class="dropdown-item" href="#">Item</a>
<a class="dropdown-item" href="#">Item</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="#">PQRS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Trabaje Con Nosotros</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Intranet</a>
</li>
<li>
<i class="fab fa-instagram"></i>
</li>
<li>
<i class="fab fa-twitter"></i>
</li>
<li>
<i class="fab fa-facebook"></i>
</li>
</ul>
</div>
<!-- End -->
<!-- Your website Links -->
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<?php wp_nav_menu( array
(
'menu' => 'primary',
'container' => 'ul',
'theme_location' => 'primary',
'menu_class' => 'menu',
'items_wrap' => '<ul>%3$s</ul>',
'fallback_cb' => 'medipress_wp_bootstrap_navwalker::fallback',
'walker' => new medipress_wp_bootstrap_navwalker()
));
?>
</div>
</nav>
Anyboby可以在这里指引我,我迷路了。