1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Stop scrolling DIV before footer

Discussion in 'jQuery' started by Borduhh, Apr 9, 2015.

  1. #1
    Hi all,

    I am implementing a scrolling div class for my ecommerce store. I wanted to make it so the div stops scrolling right above the footer (so it doesn't overlap) and stays there until the user scrolls back up. This is the code I started with but it doesn't seem to be working. Any help would be appreciated :)

    jQuery(window).scroll(function () {
        if (jQuery(this).scrollTop() > 124 ) {
            jQuery('#object-scroll').addClass('scroll-fixed');
           
            if (jQuery(this).scrollTop() > jQuery(window).height() - 289) {
                jQuery('.scroll-fixed').css('bottom','330');
            }
           
        } else {
            jQuery('#object-scroll').removeClass('scroll-fixed');
        }
    });
    Code (JavaScript):
     
    Borduhh, Apr 9, 2015 IP
  2. 2WDH.com

    2WDH.com Active Member

    Messages:
    143
    Likes Received:
    3
    Best Answers:
    5
    Trophy Points:
    68
    #2
    Hi Borduhh.

    Can you give URL to that page or post the full page source code?
     
    2WDH.com, Jun 22, 2015 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Yeah, without seeing what that's being applied to it's hard to weigh in too meaningfully, but it almost sounds like you are doing something that has no business being done on a website -- using either a massive scripting animation to automatically have a box marquee scroll 1990's style (I fell into that trap when I first started out with websites thanks to scam artist hellhouses like dynamic drive) or using JS to control user scrolling.

    But really the moment I even see jQ on a site these days I assume it's either something that should be CSS job or does not even belong on a website in the first place. If it's normal page scrolling why does it need JS... if it's automatic scrolling why would the footer placement even be involved?
     
    deathshadow, Jun 23, 2015 IP
  4. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #4
    qwikad.com, Aug 11, 2015 IP