I Trying to use the scroll to element function in the jquery mobile Iscroll
But its not working
This is what my script looks like
I tried here MyJsfiddle
$('[data-role="content"]').trigger('create');
$(".scroll-wrapper").iscrollview();
$(".scroll-wrapper").iscrollview('refresh');
$('.chequeBanks').click(function(){
$(".scroll-wrapper").iscrollview('refresh');
var bankId=$(this).val();
$('.accNumber').html($('.chequeBankDetailsSec .bankId-'+bankId+' .number').html());
$('.details').show();
$('.details').show();
var x = $('.details').offset().left;
var y = $('.details').offset().top;
$(".scroll-wrapper").iscrollview("scrollTo", x,y, '1');
});
You are almost there, the call to
scrollTo
is missing an argument. It is defined as:Here is a jFiddle that scrolls to a clicked item: http://jsfiddle.net/CKSYJ/73/
Basically, the code is:
Some useful answers to similar questions can be found here:
jQuery Mobile prevent scroll-to-top before page transition?
Jquery Mobile go back button scrolls to top