如果网址等于使用Google跟踪代码管理器,如何在页面加载时打开灯箱 [英] How to open a lightbox on page load if url equals using google tag manager

查看:106
本文介绍了如果网址等于使用Google跟踪代码管理器,如何在页面加载时打开灯箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题几乎说明了这一点.仅当网址为www.example.com/#popup与www.example.com

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

如果可以使用出色的Google跟踪代码管理器来完成

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>

推荐答案

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

请参见 https://github.com/noelboss/featherlight/#manual呼唤羽毛灯

小提琴显示手动灯箱打开通话. http://jsfiddle.net/fm9wp96r/

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

这篇关于如果网址等于使用Google跟踪代码管理器,如何在页面加载时打开灯箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆