I cannot get JQuery Scroll Function to work on my site

T. Mongoven

I am attempting an effect much like the one seen on https://codepen.io/michaeldoyle/pen/Bhsif?editors=0010 The problem is that, for some reason, it doesn't work at all on my site http://pmoore17.altervista.org/TWADrama/index.php I am trying to get the slideshow to phase out while the content phases in, and vise versa. Help?

My JQuery:

    var hidetop = $("#hidetop");
    var range = $("#hidetop").height();
    var body = $("#wrapper");

    $(window).on('scroll', function() {

      var scrollTop = $(this).scrollTop();
      var offset = hidetop.offset().top;
      var height = hidetop.outerHeight();
      offset = offset + height / 2;
      var calc = 1 - (scrollTop - offset + range) / range;

      hidetop.css({
        'opacity': calc
      });

      if (calc > '1') {
        hidetop.css({
          'opacity': 1
        });
      } else if (calc < '0') {
        hidetop.css({
          'opacity': 0
        });
      }

    });

My JQuery is currently deleted off my site because it was only increasing load time and causing images not to load.

Louys Patrice Bessette

Ok, I got it.

Remove the division by 2 in offset = offset + height / 2;.

So like this: offset = offset + height;

Also, test it with a longer page.
or - just for the test - add this:

$("#wrapper").css({"height":2000});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

I can't get my jquery to work in my wordpress site

I cannot get the favicon to work on my website?

I cannot get my "if" command to work properly

I cannot get my fancybox 2 to work

I cannot get my quiz code to work

Powershell with Selenium: I cannot get the "scroll into view" to work

I cannot call my jQuery function

Mouse scroll (scroll wheel) doesn't work in chrome for my site

In jQuery my function is not work

Cannot get my if statement inside an 'app.post' function to work

My function click() dont work with href of this site, how i can fix and make work?

I cannot get my for loop for Armstrong number in Java to work

jquery scroll doesn't work in my website

Get popper to work on my squarespace site

I can't get my first function-formula to work

Why can't I get my JavaScript replace function to work?

How can I get my binary tree insert function to work?

How do I get my async function to work? Typescript

How do i get my back (function) button to work? JS

jquery carousel for a bootstrap site covering my page on scroll

How do I get my JQuery script to work in HTML - Table

Why am I failing to get my JQuery tooltip to work?

Cannot get onClick function to work

Cannot get function declaration to work

How can I get this function to work on old jquery?

How do I get an array to work with a jQuery function?

How do i use the jquery on my site?

I am receiving an 'unexpected { in {' message for my function - cannot see where this is or understand why the function won't work

I cannot get my verifying email to work, what am i missing?