Help With Including Javascript (Fullpage.js)
-
So, i am a completely new to WordPress, and I’ve been so confused about how to code properly. I’m trying to get fullpage.js to work properly, but my inexperience is just killing me. You can see that I (think) I have the javascript and/or the css loading correctly, but it is still not working. You can see it here (wevolunteer.co/test).
I put this in my default.php in hopes that it would work, and I have no idea if it’s working properly.
function register_fullpage() { wp_register_style( 'fullPage-css', get_stylesheet_directory_uri() . '/css/jquery.fullPage.css"' ); wp_register_script( 'fullPage-js', get_stylesheet_directory_uri() . '/js/jquery.fullPage.js' , array( 'jquery' ) ); if ( is_page('your-page') ){ wp_enqueue_style( 'fullPage-css' ); wp_enqueue_script( 'fullPage-js' ); } } add_action( 'wp_enqueue_scripts', 'register_fullpage' ); function print_my_inline_script() { if ( wp_script_is( 'fullPage-js', 'done' ) ) { ?> <script type="text/javascript"> $(document).ready(function() { var pepe = $.fn.fullpage({ slidesColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'], anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'], menu: '#menu', scrollingSpeed: 1700 }); }); </script> <?php } } add_action( 'wp_footer', 'print_my_inline_script' );Thanks for reading 🙂 It helps a lot! (Also, if you could point me to any good tutorials, that would be AMAZING)
The topic ‘Help With Including Javascript (Fullpage.js)’ is closed to new replies.