1

I am currently making an android app on PhoneGap and am having trouble with linking an image, so once clicked it takes the user to a different div on the same page, I don't want to make another HTML file just for a little bit of javascript. When I test it in the android emulator, the link doesn't seem to work, where as if I change he link to an index.html it works. any help would be fantastic.

<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>

Any help would be fantastic.

Narendra Singh
  • 3,990
  • 5
  • 37
  • 78
Nick
  • 71
  • 2
  • 12

1 Answers1

1

Where is your code that does the scrolling ?

Take a look at this answer. It explains how to scroll to an element.

EDIT

I have no clue what you mean by "follow the div as a link". Divs are not links, what do you mean by loading the div?

If you want to open another link using javascript you can use:

window.location = http:\\www.google.com
Community
  • 1
  • 1
caiocpricci2
  • 7,714
  • 10
  • 56
  • 88
  • Its literally just click the link and it opens up like a whole new window, no scrolling at all – Nick Apr 17 '13 at 20:18
  • If your image and your div are on the same page, when the user clicks on the image, you should scroll to the div you want to display, right? Or I did not understand your question. – caiocpricci2 Apr 17 '13 at 21:20
  • I think your misunderstand it, in PhoneGap it should just load the div like an ordinary link. – Nick Apr 17 '13 at 21:59