例如:我輸入了郵編,我發現了商店列表,當我選擇第10條記錄並提交表單。如果我再次返回該表單,它應該使用滾動條位置獲取詳細信息。如何使用jquery動態控制滾動條?
澄清:一切都做,但讀音字無法控制滾動條
$("#search").click(function(){
var zipCode = $("#zipcodeSearch").val();
if(zipCode.length){
$.ajax({
beforeSend: function(){
$(".stores").html("Loading...");
}
, type: "post"
, cache: false
, url: '/localstores/?ajax=1&view=radioView'
, data: 'zipCode=' + zipCode
, success: function(response){
$(".stores").html(response).removeClass("error");
//Checking previously selected store
if(typeof(selectedStore_ID) != 'undefined' && selectedStore_ID != 0){
$("#" + selectedStore_ID).click();
$("#" + selectedStore_ID).offset();
}else{
//Select the first local store by default
$("[name=localStore]").eq(0).click();
}
}
, error: function(error){
console.log(error);
}
, complete: function(){
if($(".stores").html() == "loading..."){
$(".stores").empty();
}
}
})
}else{
$(".stores").addClass("error").empty().html("Please enter a postcode first.");
}
});
//On click of radio items, showing the item as selected
$(".stores").delegate("[name=localStore]","click", function(){
var id = $(this).attr("id");
$("#selectedStore").html($(this).parent("td").next("td").children("label").html());
$("#selectedStoreId").val(id);
});
});
感謝,納雷什
部分代碼將幫助 –
正在處理的主題:'您還沒有試圖找到答案的問題(顯示您的工作!)' – MLeFevre
請澄清併發布一些代碼。它不清楚,如果你是在談論一個記錄表或選擇框列表(或其他完全) – Moob