Hello i have these piece of code :
var note = $('#just-a-slider .handle');
updatePosition(note);
new Dragdealer('just-a-slider', {
animationCallback: function(x, y) {
$('#just-a-slider .value').text(Math.round(x * 100));
var left = note.position().left;
localStorage.setItem("left", left);
console.log(left);
}
});
function updatePosition(note) {
var left = localStorage.getItem("left");
note.css({ transform: "translateX " +left + "px" });
}
But it doesn't work for some reasons.
-
The variable stored in left is good, and work if i write this :
function updatePosition(note) { var left = localStorage.getItem("left"); note.css({ left: left + "px" }); }but not with :
note.css({ transform: "translateX " +left + "px" }); -
For exemple this code work :
var left = 100; //or xx; note.css({ transform: "translateX " +left + "px" });
So if think "transform" is not compatible with localstorage ? Am i wrong ?
What's the solution ? Thank you for the help.
(Sorry, i'm french)
Aucun commentaire:
Enregistrer un commentaire