• Resolved jenniferchosson

    (@jenniferchosson)


    Hello,
    WHAT WORKS:
    I made a popup mapped with MailChimp. It works perfectly when I set the display option to “Scroll and/or time delay: 70% / 0sec”.

    WHAT I WANT
    I want the popup to display at the end of a post

    WHAT I TRIED
    I set this option to “Scroll to element: #respond”, or “.entry-footer”, but it never shows up.
    With firebug, I tried the jQuery selectors :
    $j = jQuery.noConflit();
    $j(“#respond”);
    $j(“.entry-footer”);

    Elements are well found.

    MY WEBSITE:
    My website (french): http://www.unepromenadedesaveurs.fr/les-freres-toques/

    Do I do something wrong ?
    Thanks,
    Jennifer.

    https://wordpress.org/plugins/scroll-triggered-boxes/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jenniferchosson

    (@jenniferchosson)

    Looking at the JS, I think I found the problem.
    In the function ‘$DGD.placeBox = function (box)’, the plugin calculates the height of the wanted element, and converts it as a height rate, so it will act as a classical “scroll” setting. So the detector has to consider it as a scroll element. So I modified the condition to allow ‘element’ type:

    $DGD.calcScroll = function () {
    var scrolled = (document.body.scrollTop || parseInt(jQuery(document).scrollTop(), 10)),
    rate = Math.round((scrolled + 0.001) * 10 / (this.toScroll + 0.001)) * 10,
    i,
    box;
    for (i = 0; i < this.boxes_wait_for_scroll.length; i++) {
    box = this.boxes_wait_for_scroll[i];
    if ((box.trigger.action === ‘scroll’ || box.trigger.action === ‘element’) && rate >= box.trigger.scroll && box.hidden && !box.closed) {
    if (box.trigger.delaytime > 0) {
    this.regTimedOpening(box, box.trigger.delaytime);
    } else {
    this.showBox(box, false);
    }
    }
    if ((box.trigger.action === ‘scroll’ || box.trigger.action === ‘element’) && rate < box.trigger.scroll && !box.hidden) {
    this.hideBox(box);
    }
    }
    };

    Another soluction could be to change the type of the box once we know the wanted scroll rate :

    if (box.trigger.action === ‘element’) {
    if (jQuery(box.trigger.element).length > 0) {
    elementheight = jQuery(box.trigger.element).offset().top;
    this.toScroll = this.docheight – this.screenheight;
    box.trigger.scroll = ((elementheight – this.screenheight) + 0.001) / (this.toScroll + 0.001) * 100;
    box.trigger.action = ‘scroll’;
    } else {
    box.trigger.scroll = 111;
    this.echo(‘Element ‘ + box.trigger.element + ‘ is missing’);
    }
    }

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Jennifer,

    That is some amazing debugging and detailed post, and I was about to dig into it when I noticed the $DGD variable. I think you’re looking at the wrong plugin, DGD seems to be this one: https://wordpress.org/plugins/dreamgrow-scroll-triggered-box/ .

    Good luck!

    Thread Starter jenniferchosson

    (@jenniferchosson)

    Indeed ! It looks like those 2 plugins have the same name !
    In the admin page, the plugin’s name is “Scroll triggered box” :S
    I’ll post it to the right forum then, thank you ! 😉
    Have a nice day !

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Scroll to element doesn't show popup’ is closed to new replies.