peachananr / onepage-scroll

Create an Apple-like one page scroller website (iPhone 5S website) with One Page Scroll plugin
http://peachananr.github.io/onepage-scroll/Demo/demo.html
9.54k stars 2.07k forks source link

How to move to a specific page #49

Closed jianbo closed 10 years ago

jianbo commented 10 years ago

Other than moveUp and moveDown can I move to a specific page?

raykanani commented 10 years ago

This worked for me

  $("#scroll").click(function(){
  $(".main").jumpTo($(this).data("target"));

a href="#" id="scroll" data-target="4">Scroll to page 4 /a

Make sure you are using the JS file with jumpTo

jianbo commented 10 years ago

Cool. it works

Henrykiki commented 10 years ago

Excuse-me @raykanani, can you tell me where you paste the code

 $("#scroll").click(function(){
  $(".main").jumpTo($(this).data("target"));

because I'm very interested by this one. direct in the JS file called "jquery-onepage-scroll.js" ?

raykanani commented 10 years ago

Paste it in the < head > section between a < script > tag

Make sure to format your links with the id set to "scroll" and the data-target set to the page number you want the link to scroll to.

Also, make sure you are using the JS file with the function JumpTo

Henrykiki commented 10 years ago

I'm really bad in Javascript, what do you mean by "using the JS fiule with the function JumpTo" ?

I tried to find a "JumpTo" in my "jquery-onepage-scroll.js" but I didn't find anything :( Sorry for disturbing...

Henrykiki commented 10 years ago

Hi, again... I'm really sorry for disturbing you, but I finally find the code with "JumpTo" and I add it on my website, I did the link to them, but my link doesn't work... Can I give you a these parts of my code, if you are busy, don't hesitate, tell me and I'll leave you in peace... I put this in my <head> :

<!-- jumpTo -->
<script type="text/javascript" src="js/jquery.jumpto.js"></script>  <link href='css/jumpto.css' rel='stylesheet' type='text/css'>
<script type="text/javascrit">   $("#scroll").click(function(){      $(".main").jumpTo($(this).data("target"));  </script>

(The files are in the rights folder, and these ways are correct too) And this is my link :

<a href="#" id="scroll" data-target="2" class="next">Mais pourquoi ferais-je ça?</a>

Maybe it'll be more easy for you if I give you the full project? I can join a file with a page of my website if necessary.. Sorry, and sorry again.