简体   繁体   中英

fullPage.js not scrolling

I would like to use fullPage.js in my wp site. I have add the following code in my function.php

    function register_fullpage() {
    wp_register_style( 'fullPage-css', get_stylesheet_directory_uri() . 'js/css/jquery.fullPage.css"' );
    wp_register_script( 'fullPage-js', get_stylesheet_directory_uri() . '/js/jquery.fullPage.js' , array( 'jquery' ) );
    wp_register_script( 'vendorslimscroll-js', get_stylesheet_directory_uri() . '/js/jquery.slimscroll.min.js' , array( 'jquery' ) );
    wp_register_script( 'vendorseasing-js', get_stylesheet_directory_uri() . '/js/jquery.easings.min.js' , array( 'jquery' ) );

    wp_enqueue_style( 'fullPage-css' );
         wp_enqueue_script( 'fullPage-js' );
         wp_enqueue_script( 'vendorslimscroll-js' );
         wp_enqueue_script( 'vendorseasing-js' );
        wp_enqueue_script("jquery"); 
}

    add_action( 'wp_enqueue_scripts', 'register_fullpage' );

    function print_my_inline_script() {
           if ( wp_script_is( 'fullPage-js', 'done' ) ) { ?>
                <script type="text/javascript">
                jQuery(function($){$(document).ready(function() {
                    $('#fullpage').fullpage();
                    scrollOverflow:true
                });
                });
          </script>

         <?php }
    }
    add_action( 'wp_footer', 'print_my_inline_script' );

Then in my home page i create different section. Now every section cover all viewport, Correct! But i can't scroll the page and if i click on anchor link the page scroll down to the link and then go back to top of page. Why? What i miss?

It was just becuse I have a someting like that:

<div class="section">my content</div>
<div>other things</div> // this cause the error
<div class="section">my content</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM