miguel-perez / smoothState.js

Unobtrusive page transitions with jQuery.
MIT License
4.43k stars 508 forks source link

Parallax issues when use smoothState.js #343

Open onmarketing opened 7 years ago

onmarketing commented 7 years ago

Hi,

It very URGENT! Website for clients.

I use a jarallax: https://github.com/nk-o/jarallax for parallax, when I click menu via navbar then about us page - parallax header is was still no parallax working. See my javascript code:

$(document).ready(function() {
    function e() {
        var e = $(".hamburger"),
            a = $(".m-nav"),
            t = $(".wrapper");
        e.click(function(s) {
            e.toggleClass("is-active"), e.toggleClass("mobilenav"), a.toggleClass("show"), t.toggleClass("fixed")
        }), $(".m-nav li a").click(function() {
            t.removeClass("fixed")
        }), $(function() {
            $(".text-box").matchHeight()
        }), $(function() {
            if(jQuery(window).width() <= 991) return;
            var s = $(".header");
            $(window).scroll(function() {
            var e = $(window).scrollTop();
            e >= 500 ? s.addClass("down") : s.removeClass("down")
            })
        }), $(".splash-close").click(function() {
            $(".splash-container").removeClass("active"), $(".splash-bg").removeClass("active"), $(".wrapper").removeClass("fixed")
        }), $(".splash-close-link").click(function() {
            $(".splash-container").removeClass("active"), $(".splash-bg").removeClass("active"), $(".wrapper").removeClass("fixed")
        })
    }
    // Add smooth scrolling to all links
    $("a").on('click', function(event) {

        // Make sure this.hash has a value before overriding default behavior
        if (this.hash !== "") {
          // Prevent default anchor click behavior
          event.preventDefault();

          // Store hash
          var hash = this.hash;

          // Using jQuery's animate() method to add smooth page scroll
          // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
          $('html, body').animate({
            scrollTop: $(hash).offset().top - 100
          }, 800, function(){

            // Add hash (#) to URL when done scrolling (default click behavior)
            window.location.hash = hash;
          });
        } // End if
    });
    $(function() {
        "use strict";
        var a = $("#main"),
            t = {
                prefetch: !0,
                cacheLength: 2,
                blacklist: '.no-smoothState',
                onStart: {
                    duration: 500,
                    render: function(e) {
                        e.addClass("is-exiting"), s.restartCSSAnimations()
                    }
                },
                onReady: {
                    duration: 0,
                    render: function(e, a) {
                        e.removeClass("is-exiting"), e.html(a)
                    }
                },
                onAfter: function() {
                    e()
                    window.ga("send", "pageview", window.location.pathname)
                }
            },
            s = a.smoothState(t).data("smoothState")
    }), e(), $("input,textarea").focus(function() {
        $(this).data("placeholder", $(this).attr("placeholder")).attr("placeholder", "")
    }).blur(function() {
        $(this).attr("placeholder", $(this).data("placeholder"))
    })
});

Please anyone help me with this issues.

Thanks,

Shaun.

onmarketing commented 7 years ago

I need to be finish website by end of the week.

onmarketing commented 7 years ago

I have left message at jarallax GitHub: https://github.com/nk-o/jarallax/issues/48

shrpne commented 6 years ago

Check the FAQ and similar issues #322, #339