图片是用dotnetCharting控件在后台cs中生成的,因为图片较长,所以在前台显示的时候点击按钮,滑动可以看到后面的内容,这是通过jquery animate实现的但点击按钮的同时,还要能刷新图片(因为图片显示后和点击按钮前这段时间图片可能变化了),这是通过ajax请求重新生成图片,然后显示。问题:ajax请求显示图片之后,图片会从头开始显示(以前的滑动失效),我的解决方法是:ajax请求显示图片后,js中添加图片css("margin-left",''+lef+''),lef为记录的上次移动的距离
但是这样显示出来不好请问大侠:有没有做过类似的功能,我这种做法怎样
但是这样显示出来不好请问大侠:有没有做过类似的功能,我这种做法怎样
var lef =0;
function ShowPIC(Flag) {
$.ajax({
type: "POST",
url: "PICReport.aspx",
data: "cmd=B&FromDate=" + qFromDate + "&ToDate=" + qToDate + "&areaId=" + qAreaId,
beforeSend: function() {
$("#mess").html("loading...");
},
error: function(da) {
$("#mess").html(eMessage);
},
success: function(data) {
$("#div_show").html(data);
$("#SCLOO img").css({ "margin-left":''+lef+'px'});
}
});
if (Flag == "last") {
if(lef <0)
{
lef+=100;
$("#SCLOO").animate({"marginLeft":''+lef+'px'},800);
}
}
else {
if(lef >=-($("#SCLOO").find("img").width()-980-100))
{
lef=lef-100;
$("#SCLOO").animate({"marginLeft":''+lef+'px'},800);
}
}