1
When the user clicks on a given button the scroll position of an element is changed. I would like this action to be stored in Localstorage, but I do not know... can help me?
Here my script:
$('.btn.parteum').click(function(){
$('#textarea').animate({ scrollLeft: 0 }, 400);
return false;
});
$('.btn.parte2').click(function(){
$('#textarea').animate({ scrollLeft: 140 }, 400);
return false;
});
example: https://jsfiddle.net/g43rmesL/
thanks for the answer! here did not work... you tested? or is it that I do not know how to put there?... I put exactly as it is there.
– Thiago Soubra
Your code in question is insufficient to test. It adds your html to the question I test and having found the error.
– edson alves
Here, I did an example in the fiddle: https://jsfiddle.net/g43rmesL/
– Thiago Soubra
Is saving in the localStorage normally
– edson alves
Ué, here when I reload the page does not get in the scroll position of the button 2, back to first
– Thiago Soubra
Your answer was not very clear... You want that when reload recover this value and repeat the action right, I will edit my answer adding this function
– edson alves
now that I’ve really figured it out... I should have said "memorize" and not "store," I’m gonna edit
– Thiago Soubra
I think perhaps it would be better to say "Save to localStorage the position to hold it when reloading the page" But ok, that’s right now. Take a look
– edson alves
Thanks for everything!!!!!
– Thiago Soubra
Quiet man, see you later.
– edson alves