Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 导航到单个页面模板上的不同页面_Javascript_Html_Jquery_Css - Fatal编程技术网

Javascript 导航到单个页面模板上的不同页面

Javascript 导航到单个页面模板上的不同页面,javascript,html,jquery,css,Javascript,Html,Jquery,Css,我有一个单页模板,我正试图修改,以便在单击特定链接时,用户转到一个新页面,而不是滚动到另一个部分。我仍然希望滚动到某个部分导航,但我在需要转到不同页面的那些部分中有“调用操作”按钮。该网站是一个wordpress网站 以下是我的js代码: $(document).ready(function() { if ($("a" != ".external")){ $("a").on('click', function(event) { if ((this.has

我有一个单页模板,我正试图修改,以便在单击特定链接时,用户转到一个新页面,而不是滚动到另一个部分。我仍然希望滚动到某个部分导航,但我在需要转到不同页面的那些部分中有“调用操作”按钮。该网站是一个wordpress网站

以下是我的js代码:

$(document).ready(function() {
if ($("a" != ".external")){
        $("a").on('click', function(event) {

            if ((this.hash !== "/membership-form/") && (this.hash !== "#wood-grain") && (this.hash !== "#gifting") && (this.hash !== "#non-slip") && (this.hash !== "#wpcf7-f4-o1") && (this.hash !== "#carousel-control-next") && (this.hash !== "#carousel-control-prev") && (this.hash !== "#carouselExampleControls")) {

                event.preventDefault();

                var hash = this.hash;

                $('html, body').animate({

                    scrollTop: $(hash).offset().top - 100

                }, 800, function() {});

            }

        });
    }

});
所以在这一行
if($((“a”!=”.external”)
中,我在
中添加了一个名为external的类
向下滚动
navigation.php

  <!-- Navigation -->
<nav class="navbar sticky-top navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <a class="navbar-brand" href="#home">       <img src="https://via.placeholder.com/70x40?text=Very+Small+Logo" class="img-fluid"/>   </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarResponsive">
      <ul class="navbar-nav ml-auto">
        <li class="nav-item active">
          <a class="nav-link" href="#home">Home
            <span class="sr-only">(current)</span>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#section2">Our Story</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#section3">Events</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#section4">Gallery</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#section5">Contact Us</a>
        </li>
      </ul>
    </div>
  </div>
    </nav>

index.php

<!-- Header --><?php get_header(); ?><!--Menu -->
<?php get_template_part('navigation');?><!--Home Section -->
<div class ="parallax" id="BG-2">
    <div class="container-fluid">
        <div id="home">
            <div class="row">
                <div class="col-sm-12 text-center">
                    <div class="content">
                        <div class="mt-2 col-md-12">
                            <div data-aos="fade-up">
                                <h1 class="mt-1">CLUB BD WEST</h1>
                                <p class="lead">There are no winners or losers, ours is a philosophy of enjoyment through participation and we have organized a range of activities to suit all ages, fitness levels and activity choices.</p>                          
                            </div>        
                        </div>
                    </div>        
                </div>
            </div>
        <div class="w-100">     </div>
            <section class="top-section">
                <div data-aos="fade-up">
                    <div class="container">
                        <div class="row">
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/weights-icon.png"></img>
                                <h3>Badminton</h3>
                            </div>
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/staff-icon.png"></img>
                                <h3>Football</h3>
                            </div>
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/aerobics-icon.png"></img>
                                <h3>Cricket</h3>
                            </div>
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/spinning-icon.png"></img>
                                <h3>Recreational Cycling</h3>
                            </div>
                            <div class="col text-center">                               
                                <img class="icon" src="<?php PRINT IMAGES;?>/aerobics-icon.png"></img>                              
                                <h3>Kayaking</h3>           
                            </div>                          
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/spinning-icon.png"></img>                              
                                <h3>Nature rambling</h3>                            
                            </div>
                        </div>                      
                        <div class="row">                           
                            <div class="col text-center">                               
                                <img src="https://via.placeholder.com/500x60?text=Call+to+action+Club+Sports" class="img-fluid"/>                           
                            </div>                      
                        </div>
                    </div>                  
        </div>          
            <div class="row">       
            <div class="col-sm-12 text-center">         
                <div class="content">               
                <div class="mt-2 col-md-12">                    
                <div data-aos="fade-up">                        
                    <p class="lead">The list of activities is growing, fueled by suggestions from our members.  It’s your club and responds to your needs..</p>                 
                </div>                      
                </div>          
                </div>              
                </div>  
                </div>                      
                <div class="container">                     
                <div class="row">                           
                <div class="col text-center">                               
                <h3>Our Goals</h3>                              
                <p>To build an online social platform bringing together a diversity of people sharing a common purpose of interaction through sport and recreation.</p>                         
                </div>                          
                <div class="col text-center">                               
                <h3>Our Mission</h3>                                
                <p>To continue growth of both membership and activities developing a multicultural community with a social conscience. </p>                         
                </div>                          
                <div class="col text-center">                               
                <h3>Our Vision</h3>                             
                <p>To add to the quality of life, build cohesion in communities and enrich society.</p>                         
                </div>                      
                </div>                  
                </div>      
</section>
</div>
    </div><!-- Container End -->
<hr class="content-seperator"></hr>
    <div id="section2">
        <div data-aos="fade-up">
            <div class="container">
                <div class="row">
                    <div class="col-sm-12 text-center">
                        <h1>Our Story</h1>
                        <p>It all started when a group of friends got together for an impromptu game of badminton. The shared love of the game and the company of friends was a compelling mix and very quickly these random get togethers developed into a regular event.</p>                      <p>The group began to grow rapidly, first from within the circle of friends and later extending to others that were exposed to the group and drawn to it.  At this point it was evident that a structure was required to communicate with group members and so BD West was formed.</p>                      <p>BD West is now a not for profit social club with over 200 members and plans to grow into a multicultural community of like-minded people brought together by the love of sport, recreation and the harmony of social connection. </p>
                    </div>
                </div> 
            <br>
                <div class="row">
                    <div class="col-sm-12 text-center">
                        <h2>Our Management Team</h2>
                    </div>
                    <div class="col-sm-12 text-center">
                        <img src="https://via.placeholder.com/500x60?text=Call+to+action+Management+Team" class="img-fluid"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
<hr class="content-seperator"></hr>
</div><!-- BG End -->
<div class ="parallax" id="BG-3">       <div class="col-sm text-center">            <img src="https://via.placeholder.com/468x60?text=Advert" class="img-fluid"/>       </div>
    <div id="section3">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 mb-sm-0 text-center">
                    <div class="content">
                        <div data-aos="fade-up">
                            <h3 class="mt-2">Events</h3>
                            <p class="lead">Here are some of our latest events</p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12 text-center">
                </div>      
            </div>
        </div><!--./container -->
    </div>  <!-- ./section3 -->
<hr class="content-seperator"></hr>
</div><!--./ BG3 -->            <!-- Pricing Table -->
<div class ="parallax" id="BG-1">
    <div class="container">
        <div class="row">
            <div class="col-lg-12 mb-3 mb-sm-0 text-center">
                <div id="section4">
                    <div class="content">
                        <div data-aos="fade-up">
                            <h3 class="mt-2">Gallery</h3>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<hr class="content-seperator-yellow"></hr>
</div>        <!-- Contact Form and Location -->            
<div class ="parallax" id="BG-2">
    <div id="section5">
        <div class="container">
            <div class="row">
                <div class="col-12 text-center">
                    <div data-aos="fade-up">
                        <div class="content">
                            <h3 class="mt-2">Contact Us</h3>
                        </div>
                    </div>  
                </div>
            </div>
            <div class="row">
                <div class="col-12 text-center">
                    <div data-aos="fade-up">
                        <?php echo do_shortcode('[contact-form-7 id="16" title="Contact Us"]');?>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-12 text-center">
                    <div data-aos="fade-up">
                        <p class="lead">BD West Incorporated</p>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-12 text-center">
                    <div data-aos="fade-up">
                        <div class="content">
                        </div>  
                    </div>
                </div>  
            </div>              
        </div>
    </div>
</div>
<!--Footer Section -->
<?php get_footer();?>

西区屋宇署俱乐部

没有赢家或输家,我们的理念是通过参与享受,我们组织了一系列活动,以适应所有年龄段、健康水平和活动选择。

/权重图标.png“> 羽毛球 /职员图标.png“> 足球 /健美操图标.png“> 板球 /旋转图标.png“> 休闲自行车 /健美操图标.png“> 皮艇运动 /旋转图标.png“> 自然漫游

在会员建议的推动下,活动列表不断增加。这是您的俱乐部,满足您的需求。

我们的目标 建立一个在线社交平台,将各种各样的人聚集在一起,通过体育和娱乐共享共同的互动目的。

我们的使命 继续增加会员人数和活动,发展具有社会良知的多元文化社区。

我们的愿景 提高生活质量,增强社区凝聚力,丰富社会。


我们的故事 这一切都始于一群朋友一起参加一场即兴的羽毛球比赛。对比赛的共同热爱和朋友们的陪伴是一种令人信服的组合,这些随机聚会很快发展成为一项常规活动。

这群人开始迅速成长,首先是在朋友圈内,然后扩展到其他接触该团体并被其吸引的人。在这一点上,很明显,需要一个与团体成员沟通的结构,因此BD West形成了。

BD West现在是一个非营利的社交俱乐部,拥有200多名成员,并计划成长为一个由志同道合的人组成的多元文化社区,他们热爱体育、娱乐和和谐的社会关系


我们的管理团队
  <!-- Navigation -->
<nav class="navbar sticky-top navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <a class="navbar-brand" href="#home">       <img src="https://via.placeholder.com/70x40?text=Very+Small+Logo" class="img-fluid"/>   </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarResponsive">
      <ul class="navbar-nav ml-auto">
        <li class="nav-item active">
          <a class="nav-link" href="#home">Home
            <span class="sr-only">(current)</span>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#section2">Our Story</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#section3">Events</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#section4">Gallery</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#section5">Contact Us</a>
        </li>
      </ul>
    </div>
  </div>
    </nav>
<!-- Header --><?php get_header(); ?><!--Menu -->
<?php get_template_part('navigation');?><!--Home Section -->
<div class ="parallax" id="BG-2">
    <div class="container-fluid">
        <div id="home">
            <div class="row">
                <div class="col-sm-12 text-center">
                    <div class="content">
                        <div class="mt-2 col-md-12">
                            <div data-aos="fade-up">
                                <h1 class="mt-1">CLUB BD WEST</h1>
                                <p class="lead">There are no winners or losers, ours is a philosophy of enjoyment through participation and we have organized a range of activities to suit all ages, fitness levels and activity choices.</p>                          
                            </div>        
                        </div>
                    </div>        
                </div>
            </div>
        <div class="w-100">     </div>
            <section class="top-section">
                <div data-aos="fade-up">
                    <div class="container">
                        <div class="row">
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/weights-icon.png"></img>
                                <h3>Badminton</h3>
                            </div>
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/staff-icon.png"></img>
                                <h3>Football</h3>
                            </div>
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/aerobics-icon.png"></img>
                                <h3>Cricket</h3>
                            </div>
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/spinning-icon.png"></img>
                                <h3>Recreational Cycling</h3>
                            </div>
                            <div class="col text-center">                               
                                <img class="icon" src="<?php PRINT IMAGES;?>/aerobics-icon.png"></img>                              
                                <h3>Kayaking</h3>           
                            </div>                          
                            <div class="col text-center">
                                <img class="icon" src="<?php PRINT IMAGES;?>/spinning-icon.png"></img>                              
                                <h3>Nature rambling</h3>                            
                            </div>
                        </div>                      
                        <div class="row">                           
                            <div class="col text-center">                               
                                <img src="https://via.placeholder.com/500x60?text=Call+to+action+Club+Sports" class="img-fluid"/>                           
                            </div>                      
                        </div>
                    </div>                  
        </div>          
            <div class="row">       
            <div class="col-sm-12 text-center">         
                <div class="content">               
                <div class="mt-2 col-md-12">                    
                <div data-aos="fade-up">                        
                    <p class="lead">The list of activities is growing, fueled by suggestions from our members.  It’s your club and responds to your needs..</p>                 
                </div>                      
                </div>          
                </div>              
                </div>  
                </div>                      
                <div class="container">                     
                <div class="row">                           
                <div class="col text-center">                               
                <h3>Our Goals</h3>                              
                <p>To build an online social platform bringing together a diversity of people sharing a common purpose of interaction through sport and recreation.</p>                         
                </div>                          
                <div class="col text-center">                               
                <h3>Our Mission</h3>                                
                <p>To continue growth of both membership and activities developing a multicultural community with a social conscience. </p>                         
                </div>                          
                <div class="col text-center">                               
                <h3>Our Vision</h3>                             
                <p>To add to the quality of life, build cohesion in communities and enrich society.</p>                         
                </div>                      
                </div>                  
                </div>      
</section>
</div>
    </div><!-- Container End -->
<hr class="content-seperator"></hr>
    <div id="section2">
        <div data-aos="fade-up">
            <div class="container">
                <div class="row">
                    <div class="col-sm-12 text-center">
                        <h1>Our Story</h1>
                        <p>It all started when a group of friends got together for an impromptu game of badminton. The shared love of the game and the company of friends was a compelling mix and very quickly these random get togethers developed into a regular event.</p>                      <p>The group began to grow rapidly, first from within the circle of friends and later extending to others that were exposed to the group and drawn to it.  At this point it was evident that a structure was required to communicate with group members and so BD West was formed.</p>                      <p>BD West is now a not for profit social club with over 200 members and plans to grow into a multicultural community of like-minded people brought together by the love of sport, recreation and the harmony of social connection. </p>
                    </div>
                </div> 
            <br>
                <div class="row">
                    <div class="col-sm-12 text-center">
                        <h2>Our Management Team</h2>
                    </div>
                    <div class="col-sm-12 text-center">
                        <img src="https://via.placeholder.com/500x60?text=Call+to+action+Management+Team" class="img-fluid"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
<hr class="content-seperator"></hr>
</div><!-- BG End -->
<div class ="parallax" id="BG-3">       <div class="col-sm text-center">            <img src="https://via.placeholder.com/468x60?text=Advert" class="img-fluid"/>       </div>
    <div id="section3">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 mb-sm-0 text-center">
                    <div class="content">
                        <div data-aos="fade-up">
                            <h3 class="mt-2">Events</h3>
                            <p class="lead">Here are some of our latest events</p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12 text-center">
                </div>      
            </div>
        </div><!--./container -->
    </div>  <!-- ./section3 -->
<hr class="content-seperator"></hr>
</div><!--./ BG3 -->            <!-- Pricing Table -->
<div class ="parallax" id="BG-1">
    <div class="container">
        <div class="row">
            <div class="col-lg-12 mb-3 mb-sm-0 text-center">
                <div id="section4">
                    <div class="content">
                        <div data-aos="fade-up">
                            <h3 class="mt-2">Gallery</h3>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<hr class="content-seperator-yellow"></hr>
</div>        <!-- Contact Form and Location -->            
<div class ="parallax" id="BG-2">
    <div id="section5">
        <div class="container">
            <div class="row">
                <div class="col-12 text-center">
                    <div data-aos="fade-up">
                        <div class="content">
                            <h3 class="mt-2">Contact Us</h3>
                        </div>
                    </div>  
                </div>
            </div>
            <div class="row">
                <div class="col-12 text-center">
                    <div data-aos="fade-up">
                        <?php echo do_shortcode('[contact-form-7 id="16" title="Contact Us"]');?>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-12 text-center">
                    <div data-aos="fade-up">
                        <p class="lead">BD West Incorporated</p>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-12 text-center">
                    <div data-aos="fade-up">
                        <div class="content">
                        </div>  
                    </div>
                </div>  
            </div>              
        </div>
    </div>
</div>
<!--Footer Section -->
<?php get_footer();?>
$(location).attr('href', 'http://stackoverflow.com')
// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";