2013-04-17 81 views
1

我目前在PhoneGap上製作一個Android應用程序,並且無法連接圖像,所以一旦點擊它就會將用戶轉到同一頁上的不同div,我不會想要製作另一個HTML文件只是爲了一點點的JavaScript。當我在android模擬器中測試它時,鏈接似乎不起作用,因爲如果我改變他鏈接到一個index.html它的作品。任何幫助都會很棒。Eclipse PhoneGap HTML div鏈接不工作

<div data-role="page" id="workpage"> 
<div data-role="header"> 
    <h1>Work</h1> 
</div> 
<div data-role="content"> 
<div data-role="navbar"> 
    <a href="index.html">Back</a> 
</div> 
    <a href="#work1"><img src="work/example1.png" id="content"></a> 
    <div data-role="navbar"> 
    <a href="index.html">Back</a> 
</div> 
<div data-role="footer"> 
    <h4>© 2013 Nick Willcox</h4> 
</div> 
</div> 
<div data-role="page" id="work1"> 
<div data-role="header"> 
    <h1>Work</h1> 
</div> 
<div data-role="content"> 
    <div data-role="navbar"> 
    This was the first website I created, its purpose was to be a small business card which shown a little information about myself. I used HTML4, Photoshop and CSS. 
    <a href="work.html">Back</a> 
</div> 
</div> 
<div data-role="footer"> 
    <h4>© 2013 Nick Willcox</h4> 
</div> 

任何幫助將是非常美妙的。

回答

1

你的代碼在哪裏滾動?

看一看this answer.它解釋瞭如何滾動到一個元素。

編輯

我不知道你的意思是什麼「跟隨DIV爲紐帶」。 Div不是鏈接,加載div是什麼意思?

如果你想使用,你可以使用JavaScript來打開另一個鏈接:

window.location = http:\\www.google.com 
+0

它字面上只需點擊該鏈接,它開闢了像一個全新的窗口,沒有在所有 – Nick

+0

滾動如果你的形象,你的DIV是在同一頁面上,當用戶點擊圖像時,您應該滾動到要顯示的div,對吧?或者我不明白你的問題。 – caiocpricci2

+0

我認爲你誤解了它,在PhoneGap中它應該像普通鏈接一樣加載div。 – Nick