Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fullpage js slide effect?

I'm trying to use Fullpage.js. Here is my script:

<div id="fullpage" style="margin-top: 55px">
    <div class="section" id="first" style="background-color: red">Some section - Home</div>
    <div class="section" id="services" style="background-color: blue">Some section - Services</div>
    <div class="section" id="why" style="background-color: green">Some section - Why</div>
    <div class="section" id="portofolio" style="background-color: red">Some section - Portofolio</div>
    <div class="section" id="price" style="background-color: blue">Some section - Price</div>
</div>

<script type="text/javascript">
   $(document).ready(function() {

$('#fullpage').fullpage({
    menu: '#navbarNav',
    css3: true,
    scrollingSpeed: 1000
});
});
</script>

The problem is, there is no slide effect in my HTML page. Any solutions? I don't see any errors in my browser console.

UPDATE

There is a second problem, When I scroll to random section then I click the menu, the anchor is not working, I mean it keeps at the section which I scroll.

like image 958
YVS1102 Avatar asked Sep 29 '17 06:09

YVS1102


3 Answers

You need to define your anchors in your script, like this:

$(document).ready(function() {
    $('#fullpage').fullpage({
        menu: '#navbarNav',
        css3: true,
        scrollingSpeed: 1000,
        anchors:['first, 'secondPage', 'why', 'portofolio', 'price']
    });
};

Source: https://github.com/alvarotrigo/fullPage.js#fullpagejs

like image 153
JoostS Avatar answered Oct 19 '22 18:10

JoostS


please, could you insert your javascript code inside the $(document).ready() to be sure that it is ready to execute. In your case, it should be something like:

    <script type="text/javascript">
       $(document).ready(function() {
          $('#fullpage').fullpage({
             menu: '#navbarNav',
             css3: true,
             scrollingSpeed: 1000
         });
      };
   </script>

Hope this can resolve your problem. Thank you

like image 42
ervidio Avatar answered Oct 19 '22 18:10

ervidio


You need to write the ID on href anchor attribute like this

<ul id=#menu> 
   <li data-menuanchor="first" class="active">
   <a href="#first">First</a>
    </li>
    <li data-menuanchor="services" class="active">
   <a href="#services">Services</a>
   </li>
</ul>
like image 33
Ricardo diaz Avatar answered Oct 19 '22 16:10

Ricardo diaz