因此,当输入错误的密码/用户名时,我尝试打开我的模式。我已经搜索了谷歌,但我想不出一个好的解决方案来解决如何用W3.CSS做到这一点。我的模式是由一个名为"id01"的ID打开的,然后我尝试了在stackoverflow中找到的一个小javascript:Open modal with # in url。尝试在W3.CSS的帮助下对其进行编辑后:
function popModal() {
modal.style.display = "block";
}
var hash = window.location.hash;
if (hash.substring(1) == 'id01') {
popModal();
}它仍然不起作用。所以长话短说。当url中有类似:"#1234"时,我如何使模式打开?
发布于 2016-09-08 20:12:28
试试这个:
$( document ).ready(function() {
//console.log( window.location.href );
if(window.location.href.indexOf("#1234") > -1) {
alert("your url contains #1234");
popModal();
}
});https://stackoverflow.com/questions/39386853
复制相似问题