Skip to main content
LGMTL
Inspiring
August 3, 2017
Answered

Strange gap under parallax section in Chrome but not Firefox

  • August 3, 2017
  • 1 reply
  • 982 views

I've got a strange white gap beneath a parallax section which appears in Chrome and IE: http://prntscr.com/g3on35  but not in Firefox.

As you scroll down this page Supreme - VISION   you'll notice a gap appears towards the bottom just before the footer. 

Here's the parallax.js file, in RED:

$(window).scroll(function(e) {

  parallax();

})

function parallax() {

  var scroll = $(window).scrollTop();

  var screenHeight = $(window).height();

  $('.parallax').each(function() {

    var offset = $(this).offset().top;

    var distanceFromBottom = offset - scroll - screenHeight

   

    if (offset > screenHeight && offset) {

      $(this).css('background-position', 'center ' + (( distanceFromBottom  ) * 0.2) +'px');

    } else {

      $(this).css('background-position', 'center ' + (( -scroll ) * 0.2) + 'px');

    }

  })

}

Is there a way to get it to display the way it does in Firefox without the gap?

Brandon

    This topic has been closed for replies.
    Correct answer osgood_

    brandonw6890098  wrote

    lol yes that was the wrong link sorry but it happens on all the images not that one.  It's the bottom image before the footer.

    Supreme - GALAXY CONTEMPORARY

    Supreme - GALAXY TRANSITIONAL

    Have you considered just having the bottom image 'static' not moving as you scroll?

    Remove the parallax class from the second image section

    1 reply

    Legend
    August 3, 2017
    LGMTL
    LGMTLAuthor
    Inspiring
    August 3, 2017

    lol yes that was the wrong link sorry but it happens on all the images not that one.  It's the bottom image before the footer.

    Supreme - GALAXY CONTEMPORARY

    Supreme - GALAXY TRANSITIONAL

    Jon Fritz
    Community Expert
    Community Expert
    August 3, 2017

    Are your Chrome and FF windows the same size?

    I saw no gap at first, in Chrome and had one in FF. Changing the size of the browser windows so they were the same as the "gapless" Chrome, fixed it in FF.

    That's one of the artifacts of using background-size:cover (which your parallax code does).

    You can change the background color so it's not white in the selector...

    .container-galaxy_contemporaryb

    ...in the mystyles.css file at around line 259