2013-10-31 21 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}