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’);
}
}
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!
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 !