javascript - Identify width of div from previous page -


i creating website set layout, yet 1 element expands width specific page through .animate().

this works statically, if know page came. yet, if order changes width of elements not correspond more.

what need way identify page came set width of div on current page width of div on previous page. change width needed in order create smooth transition.

this within same website, yet different html documents per page.

example

$(document).ready(function(){     var widthdivprev    =   width div page user came     $("#currentdiv").css({             "width": "widthdivprev",      });      $( "#currentdiv" ).animate({            width:"800px",     }, 1500 );   }); 

this piece of code can't figure out

var widthdivprev = [get width div page user came]

or maybe even

var idpage = [pagefrom user came]

even if can last can use if function width css

save width of current page in sessionstorage

if (sessionstorage.divwidth) {     //page came page of site     $("#currentdiv").css({         "width": sessionstorage.divwidth+"px" //set current divwidth equal previous pages divwidth     });      $("#currentdiv").animate({         "width": "800px"     }, 1500);   } else {     sessionstorage.divwidth = "800"; // set session variable next page }   

hope helps..!!


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -