Fullpage.js and mobile devices: How to enable section / slide switch if content overflow must be enabled?
Asked Answered
C

2

8

After experimenting with some of the options I still did not get satisfying result:

The used Javascript library is FullpageJS (http://alvarotrigo.com/fullPage/)

Fullpage.js is initialized with the following settings:

$('#fullpage').fullpage({
   sectionsColor: colors,
   anchors: anchors,
   scrollOverflow: true,
   afterSlideLoad: function() {
      startTheSliders();
   },
   onLeave: function(index) {
        setTimeout(function() {
            $.fn.fullpage.scrollSlider(index,0);
        },1000);
   }
});

Important: According to the documentation scrollOverflow:true is set (and must be set to true), because especially on mobile devices the content of a slide is sometimes higher than the screen height.

However it is absolutely required that users can switch horizontally and vertically between the slides with the finger (not navigation). Intended behaviour is as follows:

  1. Horizontal switch switch slide if the finger moves left or right

  2. Vertical switch slide: Next bottom slide only if slide is scrolled to the bottom and finger moves down. Next top slide: Only if slide is scrolled to the top and finger moves up.

The (former) dev project can be found here: http://www.studiodankl.com/

Chaddie answered 22/10, 2015 at 18:37 Comment(0)
C
3

The problem actually had nothing to do with fullpage.js itself - it actually turned out to be an invalid plugin modification.

However as some others experienced this issue: Check any additional HTML, CSS and especially JavaScript as this is most likely to cause a problem.

Chaddie answered 1/11, 2015 at 23:19 Comment(0)
M
3

I would not recommend you to use scrollOverflow for mobile devices.

If you want a real responsive site you should adapt the content to the device and not made use of "hacky" scroll bars to fit the content.

You can make use of the class fp-auto-height on the sections in which your content will be overflowing on mobile devices. You should only add it when your site gets responsive, this is, under certain width or height limits.

This way those sections will be able to be bigger than the device viewport.

Combining that with the responsiveHeight or responsiveWidtdh options of fullpage.js (that set autoScrolling:false) you will be able to have a pretty responsive site on small screen devices.

As an example you can take a look at this site using fullpage.js using a small viewport. It is not using the fp-auto-height option but the result is exactly the same.

In that case the site us using this:

/*screen resolutions smaller than 950px height*/
@media (max-width: 950px){
    #section3.fp-section,
    #section3 .fp-tableCell{
        height: auto !important;
        min-height: 100%;
    }
}

Which is pretty similar to what fullpage.js uses for fp-auto-heigh:

.fp-auto-height.fp-section,
.fp-auto-height .fp-slide,
.fp-auto-height .fp-tableCell{
    height: auto !important;
}

UPDATE

fullpage.js provides now the class fp-auto-height-responsive for this same purpose. More in the docs.

Morganne answered 23/10, 2015 at 11:9 Comment(1)
Thx however the customer wants the slides to be slideable on mobile devices.Chaddie
C
3

The problem actually had nothing to do with fullpage.js itself - it actually turned out to be an invalid plugin modification.

However as some others experienced this issue: Check any additional HTML, CSS and especially JavaScript as this is most likely to cause a problem.

Chaddie answered 1/11, 2015 at 23:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.