scroll - jQuery in page back button scrolling -


i looking create page allows use of , forwards buttons content within page. have accomplished basic functionality using jquery address featured at

  • http://www.asual.com/jquery/address

the issue having how callback function work in coordination jquery scrollto plugin provide animated , forwards scrolling experience.

//navigation between slides $('.nav-button').click(function(e) {     e.preventdefault();     $.scrollto($(this).attr('href'), 'slow', {easing:'easeinoutexpo'}); });  //storage , activation of , forwards attributes $('a').click(function() {     $.address.value($(this).attr('href'));   });  //callback scroll on or forwards //need here $.address.change(function(event) {     $.scrollto(event.value(), 'slow', {easing:'easeinoutexpo'}); }); 

as im sure can see problem isnt difficult, since im still learning out of scope of knowledge. appreciated.

all of content contained within 1 page divided different "pages" use of various div elements common class

update:

i created fiddle display issue more clearly.

jsfiddle.net/d7uz7/6

the bottom section of jquery used trigger scrolling after or forward page event

solution:

so after long time battling solution (of sorts) has been found. also, should not without chat jacobmclock none of have been possible.

anyhow, last section of original post should changed 1 of 2 following code blocks

//method 1 $.address.change(function (event) {     var value = event.value,     = value.indexof('#'),     $element = (i === -1) ? $("body") : $(value.substr(i, value.length-1));     $.scrollto($element, 'slow', {easing:'easeinoutexpo'}); });  //method 2 $(window).on('hashchange', function(event) {     event.preventdefault();     $.address.change(function (event) {         var value = event.value,         = value.indexof('#'),         $element = (i === -1) ? $("body") : $(value.substr(i, value.length-1));         $.scrollto($element, 'slow', {easing:'easeinoutexpo'});     }); }); 

use first block best speed, lack of compatibility. function desired in chrome , safari , glitchy in others. because handle hashchange , popstate events correctly while others not. oddly older browsers work properly.

the second method, while slower (there notable delay on animation start), work in browsers semi-well. yep, semi-well, still fails. reality due browsers not using these tags correctly youre stuck boring old non-animated , forward in page transitions. sad. unless feel doing monumental amount of coding.

i don't think event.value() want. see examples on page event.value is: http://www.asual.com/jquery/address/samples/api/. string url, , not href or element id. you'll have element want scroll value, depends on how injecting value url.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -