• Resolved jphilung

    (@jphilung)


    There’s an edge case where the plugin conflicts with previews of forms in Ninja Forms as the preview uses the home page to display the preview. Should the homepage contain the shortcode, the js is enqueued but will fail as Ninja Forms does not display the content of the home page.

    The fix would entail changing the code in dd-parallax-offset.js in order to check for the existance of $(‘.parallax-section, .parallax-mobile’).

    For example :

    jQuery(document).ready(function ($) {
        var parallaxSection = $('.parallax-section, .parallax-mobile');
        if (parallaxSection.length != 0) {
            var pxcontentOffset = parallaxSection.offset().left;
            $('.parallax-content').css('left', '-' + pxcontentOffset + 'px');
            $(".px-mobile-container").each(function () {
                var i = $(this).attr("data-factor") * $(window).width();
                $(this).css("height", i + "px")
            })
        }
    });
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author thehowarde

    (@thehowarde)

    I will review this.

    Plugin Author thehowarde

    (@thehowarde)

    Are you using the offset? The offset script is only enqueued if offset="true" is set.

    Thread Starter jphilung

    (@jphilung)

    Yeah, the offset is used. The problem arises because the Ninja Forms preview uses the page content for the homepage, but removes the content. The content has the shortcode and thus Parallax Image enqueues the script and fails on the non existing parallax section. It’s better to check for existence in the js.

    Plugin Author thehowarde

    (@thehowarde)

    This has been implemented.

    Thread Starter jphilung

    (@jphilung)

    Great !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘JavaScript error on edge cases’ is closed to new replies.