我做了一吨的研究,但我需要一个更加个性化的回答,我非常积极的节约可拖动值需要一个饼干解决方案与jQuery的.slider在那里你可以保存这样jQuery可拖动,重新加载页面后保存位置?
//jQuery UI Slider
jQuery(".slider").slider({
animate: true,
range: "min",
value: $("input.slider-value").val(),
min: 50,
max: 700,
step: 1,
//this gets a live reading of the value and prints it on the page
slide: function(event, ui) {
jQuery("#slider-result").html(ui.value);
jQuery(".static_preview_image").height(ui.value);
},
//this updates the hidden form field so we can submit the data using a form
change: function(event, ui) {
jQuery('#hidden').attr('value', ui.value);
}
});
$(".static_preview_image").css({height: $("input.slider-value").val()}); //This gives my element the height of the slider, it get stored in my slider function...
从我的研究价值.draggable不能以相同的方式工作,它需要cookie?
如果那是真的,有人可以解释如何可能使用cookies在最干净的方式,我只是想救顶部,左,右,底部值...
这里是我的拖拽功能
$(".MYELEMNT").draggable({
containment: '#_moon_static_bg_status', // I set some containment
// Read this in another post, this outputs a live value of .MYELEMNT from the start of the drag.
start: function(event, ui) {
// Show start dragged position of image.
var Startpos = $(this).position();
$("div#start").text("START: \nLeft: "+ Startpos.left + "\nTop: " + Startpos.top);
},
// Same as above but prints the current position where MYELEMNT stops
stop: function(event, ui) {
// Show dropped position.
var Stoppos = $(this).position();
$("div#stop").text("STOP: \nLeft: "+ Stoppos.left + "\nTop: " + Stoppos.top);
}
});
我想说它作为写类似的东西我怎么弄滑块
$(".static_preview_image").css({height: $("input.slider-value").val()});
的价值简单,但我想我需要使用Cookie ...
这看起来很适合使用[localstorage](http://stackoverflow.com/questions/2010892/storing-objects-in-html5-localstorage)。 – DaoWen
现在阅读它,它是一种不使用数据库存储数据的方式吗? –
这似乎有点凌驾于我的头上...... –