您可以使用javascript尝试以下逻辑:
页面加载检查url中是否存在类似以下内容的哈希:
var hash = decodeURIComponent(location.hash.substr(1));
<然后您将有两个表(一个用于团队,一个用于顾问),其名称与您的模态URL匹配(例如:
https://greentec-capital.com/team/peter-grouev/) 例如:
var teamHashes = [\'peter-grouev\', \'erick-yong\'];
<之后,您将检查
hash
在您的一张桌子里*:
if teamHashes.indexOf(hash) !== -1 { //show modal logic }
*如果
hash
不在
teamHashes
表,然后检查
advisorsHashes
桌子
现在在上面if
, 要显示模态,我们需要声明$modal
就像在代码中一样,构造url并对其进行ajax调用,如:
if teamHashes.indexOf(hash) !== -1 {
var $teamModal = new tingle.modal({
footer: true,
stickyFooter: false,
closeMethods: [\'overlay\', \'escape\'],
closeLabel: "Close",
cssClass: [\'team-modal\'],
onOpen: function() {
console.log(\'modal open\');
},
onClose: function() {
console.log(\'modal closed\');
$modal.setContent("");
},
var teamUrl = "https://greentec-capital.com/team/"+hash+"/";
$.ajax({
type: "POST",
url: teamUrl,
data: {},
success: function(result){
$modal.setContent(result);
$modal.open();
}
});
});
这应该可以做到。