我正在使用Sammy.js作爲我的網站,並且我想發送一個鏈接到網站上的某個頁面給某個人發送電子郵件。我已經建立了這樣的鏈接:鏈接到Sammy.js網站內的頁面
this.get('#/', function(context) {
$("#main").load("sections/home.html");
});
this.get('#/:page', function(context) {
$("#main").load("sections/" + this.params['page'] + ".html");
});
第一個是默認的,所以,當你在我的網站類型,進入到home.html的部分第一,如果我走了這一點,當我去我的網站,沒有加載#main
。現在,如果我只是輸入我的網址欄mywebsite.com/#/contact
,它將加載mywebsite.com/#/
,換句話說,直接到主頁。
我會說,如果我先去首頁,mywebsite.com/#/
,然後修改我想要的網頁的URL,它會工作。如果我按Enter鍵重新加載頁面,或者如果我嘗試再次修改它,它將返回到主頁。請幫忙。
此外,如果這可能會干擾,我稍後使用一個小AJAX jQuery。儘管如此,我認爲無論如何我都會遇到問題。 – ArtlyticalMedia
您是在$(document).ready()中定義路由和調用運行('#/')嗎? ('#main',function(){(「#header」)。load(「templates/header.html」); $(「#nav- – rivarolle
」)我開始這樣的main.js代碼 $ (「#footer」)。load(「templates/footer.html」);' 然後上面的代碼,然後像這樣結束: '})。run();' – ArtlyticalMedia