Reputation: 63
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?
Upvotes: 1
Views: 1110
Reputation: 63
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>
Upvotes: 2