How to open a lightbox on page load if url equals using google tag manager

会有一股神秘感。 提交于 2019-12-13 07:52:32

问题


The title pretty much says it. I would like to show a lightbox on page load only if the url is www.example.com/#popup versus www.example.com

If this could be accomplished with google tag manager that would be grand

I've see bits and pieces of this but I'm having trouble piecing it all together.

HTML:

<a href="#" data-featherlight="#mylightbox">Open element in lightbox</a> 
<div id="mylightbox">This div will be opened in a lightbox</div>

回答1:


if (window.location.hash == "#popup") {
    $.featherlight("#mylightbox");                   
}

See https://github.com/noelboss/featherlight/#manual-calling-of-featherlight

Fiddle Shows manual lightbox open call. http://jsfiddle.net/fm9wp96r/



来源:https://stackoverflow.com/questions/29923109/how-to-open-a-lightbox-on-page-load-if-url-equals-using-google-tag-manager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!