2013-10-31 23 views
1

如果有某种方式可能,有人可以指向正确的方向。如何使用散列(#)打开基础显示模式

我有一封电子邮件我想发送给用户一个指向特定页面的链接。我在该页面上有模态,并且我希望页面根据网址以特定模式打开。 例子:

domain.com/story/#story1 

打开与打开的页面显示模式与ID #story1

我真的很感激,如果有人可以帮助。

我设法有模态窗口打开,同时通过

("#Modal8").foundation('reveal', 'open'); 

有人浏览页面建议我用

<script> 
    var hash = window.location.hash; 

    if (hash === "#story8") { 
     $('#Modal8').reveal({ 
      animation: 'fadeAndPop',     //fade, fadeAndPop, none 
      animationspeed: 300,     //how fast animtions are 
      closeonbackgroundclick: true,   //if you click background will modal close? 
      dismissmodalclass: 'close-reveal-modal' //element that will close an open modal 
     }); //You can use same modal or different modal to show success message 
    } 
</script> 

我曾尝试没有成功。

+1

什么是'ef('#Modal8')'? –

回答

1

我为我的项目使用了Expressionengine,所以我想出了一个简单的解决方案。也许它会帮助别人。我在页面上有8个Modals,我有8个条件。我想你可以在频道中使用条件。 :)

{if last_segment == 'Modal8'} //Modal8 can be changed to any url: latestnews or smth. 
$("#Modal8").foundation('reveal', 'open'); 
</script> 
{/if}