A
A
Alexander Timofeev2015-12-01 18:58:02
JavaScript
Alexander Timofeev, 2015-12-01 18:58:02

Why does the scroll script not work when transferring layout to modx?

On a laptop, with just layout with connected scripts, everything works.

//изменение цвета шапки при прокрутки
  $(window).scroll(function() {    
    var heightwindow = $(window).height();
    var scroll = $(window).scrollTop();
    if (scroll >= heightwindow) {
      $("nav.navbar").addClass("scrolled");
    } else {
      $("nav.navbar").removeClass("scrolled");
    }
  });

those. when scrolling down to the height of the first screen, a class should be added to the header

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Kirenkov, 2015-12-01
@DeLaVega

Well, have you checked the console?
Structure, has everything been added?
Js is exactly processed for scrolling (checked with the console)?

R
Ruslan, 2015-12-01
@ruslan_aleev

Most likely you have a problem with the paths, look carefully.
Is it also registered in your template <base href="http://askmeplz.com/"/>?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question