通过URL直接链接到开放模式窗口? [英] Linking Directly To An Open Modal Window Through a URL?
问题描述
我对编码知之甚少,所以我希望我能正确地解决这个问题。
I don't know much at all about coding so hopefully i worded the question correctly.
我想要做的是将一个人链接到一个特定的模态另一个网站上的窗口。在此示例中,我将使用Menards每周广告来展示我想要做的事情。
What I am trying to do is link a person to a specific modal window on another website. In this example, I will use the Menards weekly ad to show what I would like to do.
我想将某人直接链接到每周传单页面,其中模式窗口已经打开,用于特定产品,例如$ 74.99 5货架单位,当选择时打开此窗口( http://i.imgur.com/lntNUpK.png )。这是我想直接链接到某个人的窗口。
I would like to link somebody directly to the weekly flyer page with the modal window already open for a specific product such as the $74.99 5 Shelf Unit, which when selected opens this window (http://i.imgur.com/lntNUpK.png). This is the window that I would like to directly link to somebody.
有没有办法修改URL以使其成为可能?关于我知道怎么做的是如何链接到URL的特定页面,如下所示/main/flyer.html?page=5
Is there a way to modify the URL to make this possible? About all I know how to do is how to link to a specific page of the URL which would look like this /main/flyer.html?page=5
另外一个值得一提的是,如果你去提供广告的网站,Flipp,它确实允许你直接链接到窗口 https://flipp.com/item/175356457-muscle-rack-5shelf-steel-unit
One other thing to mention is if you go to the website that provides the ads, Flipp, it does allow you to directly link to the window https://flipp.com/item/175356457-muscle-rack-5shelf-steel-unit
感谢您的帮助!
推荐答案
是的,可以使用一些javascript,它会在网址上找到#myModal找到它,它将加载模态:
Yes it is possible with some javascript, it will look for #myModal on the url if it finds it, it will load the modal:
只需将它放在页面的末尾:
just put this at the end of your page:
$(document).ready(function() {
if(window.location.href.indexOf('#myModal') != -1) {
$('#myModal').modal('show');
}
});
现在只需使用以下网址:
Now just use the following url:
http://www.mywebsite.com/page.html#myModal
*你的模态必须有一个id:
*your modal must have an id:
这篇关于通过URL直接链接到开放模式窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!