- This topic has 11 replies, 4 voices, and was last updated 12 years, 4 months ago by
support-octavio.
-
AuthorPosts
-
YannMemberHello ,
i try to adapt a script of Octavio to a HTML widget to call a remote page when i scroll down.
it works but I need help to solve some problems
how can i change height dynamicly height of html widgetphoneui.documentReadyHandler = function() { DefilementInfini(); } function DefilementInfini() { var compteur=1; var offset = $('#m1-test-panel1-scroller').offset(); envoidata('http://mydomain.fr/test.aspx?pg='+compteur,AddInDiv); myCarousel_up = new iScroll('m1-test-panel1-scroller', { snap: true, momentum: false, hScrollbar: false, vScrollbar: false, desktopCompatibility:true, onScrollEnd: function () { if($('#m1-test-panel1-scroller').hasClass('scrolling')) { $('#m1-test-panel1-scroller').removeClass('scrolling'); } if (this.dirY == 1) { charge = "oui"; compteur++; envoidata('http://mydomain.fr/test.aspx?pg='+compteur,AddInDiv); updateListHeight(compteur,offset); } } }); } function updateListHeight(compteur,offset) { var $scroller = $('#m1-test-panel1-scroller'); var $htmobjet = $('#contenu'); var panelHt = 300 + (compteur * 200); $scroller.css("height", panelHt + "px"); $htmobjet.css("height", panelHt + "px"); $scroller[0].myScroll.refresh(); $('#m1-test-html1') .css({'height': (($(window).height()) + panelHt)+'px'}); } function AddInDiv(data) { $('#contenu').append(data); } function envoidata(url,callback) { var objHTTP, strResult; if(window.XMLHttpRequest) { objHTTP = new XMLHttpRequest(); } else if(window.ActiveXObject) { objHTTP = new ActiveXObject('Microsoft.XMLHTTP'); } objHTTP.open('POST',url,false); objHTTP.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); objHTTP.send(); strResult=objHTTP.responseText; callback(strResult); }
Dynamic resize of panel run as well but , not html widget with $htmobjet.css(“height”, panelHt + “px”);
Updated: i added this line $(‘#m1-test-html1’) .css({‘height’: (($(window).height()) + panelHt)+’px’}); and now Html widget object appears to be resized
but I’d find a way to detect the bottom of the div rather than scrollend
HTML Code:<div id="m1-test-panel1" class="m1-iscroll-wrapper m1-border-1 m1-background-2"> <div id="m1-test-panel1-scroller" class="m1-iscroll-scroller" data-bounce="true"> <div id="m1-test-html1" class="m1-custom-html m1-border-1 m1-background-3" ><div id="contenu"> </div> </div> </div> </div>
your help will be very appreciated
thanks a lot
YannFebruary 15, 2013 at 10:28 am #335478
support-octavioMemberHi Yann,
Could you try move the scroll refresh to the end of function?
function updateListHeight(compteur,offset) { var $scroller = $('#m1-test-panel1-scroller'); var $htmobjet = $('#contenu'); var panelHt = 300 + (compteur * 200); $scroller.css("height", panelHt + "px"); $htmobjet.css("height", panelHt + "px"); -->>> $scroller[0].myScroll.refresh(); $('#m1-test-html1') .css({'height': (($(window).height()) + panelHt)+'px'}); }
function updateListHeight(compteur,offset) {
var $scroller = $(‘#m1-test-panel1-scroller’);
var $htmobjet = $(‘#contenu’);
var panelHt = 300 + (compteur * 200);
$scroller.css(“height”, panelHt + “px”);
$htmobjet.css(“height”, panelHt + “px”);
$(‘#m1-test-html1’) .css({‘height’: (($(window).height()) + panelHt)+’px’});
$scroller[0].myScroll.refresh();
}February 16, 2013 at 8:12 am #335498
YannMemberHello,
thanks Octavio,
now i try to detect bottom of scroller div to call ajax function
i tried this :onScrollMove: function () { console.log($("#m1-test-panel1-scroller").scrollTop()); if ($(window).scrollTop() >= ($(document).height() - $(window).height())) { console.log($(document).height()); console.log($(window).scrollTop()); } });
but $(window).scrollTop() return 0 , i tried too $(“#m1-test-panel1-scroller'”scrollTop() and i have also 0
thanks for your help
YannFebruary 17, 2013 at 11:08 am #335515
YannMemberHello
i found a solution to get position but only of parent div scroller : m1-test-panel1if (this.y==this.maxScrollY) { call funtion() }
if i get position of m1-test-panel1-scroller this.y return 0
i try to resize m1-test-panel1, m1-test-panel1-scroller to have a longer scroller bar without succes at this time.
thanks for your help
YannFebruary 18, 2013 at 7:51 am #335543
YannMemberHello
i don’t understand why i can get y position of div panel1 and not panel1-scroller
if i putMyScroller = new iScroll('m1-test-panel1 {
this.y return a good value.
if i putMyScroller = new iScroll('m1-test-panel1-scroller {
this.y return always 0
My problem : I can not resize the scroller with thenew height after a call from the remote page
someone can help me?
thanks
YannFebruary 25, 2013 at 11:22 am #335899
support-michaelKeymasterYann,
I hate to be dense on this topic but I’m having trouble following it and working through the question(s). Is there anyway to you can setup a small example project that we can work together to understand exactly what the requirements and implementation details?
February 25, 2013 at 11:28 am #335901
BrandonMemberJust a guess, but if the scroller is inside the panel it could be reflecting the y position in relation to the panel, and not the app.
February 25, 2013 at 12:51 pm #335908
YannMemberHello Wayne
in attached zip file an example of my problem.
Thanks
YannAttachments:
You must be logged in to view attached files.February 25, 2013 at 1:27 pm #335909
support-octavioMemberThanks for shared the example, we have it in queue for review later today or tomorrow, will follow up asap.
February 28, 2013 at 10:39 am #336081
YannMemberHello Octavio
some news about my problem?
thanks
YannMarch 2, 2013 at 3:36 am #336160
YannMemberHello Octavio
you can close this post, i found a solution.
i adapted this script whith remote data called by ajax
http://davidwalsh.name/demo/iscroll/examples/pull-to-refresh/
YannMarch 4, 2013 at 12:14 pm #336208
support-octavioMemberThanks for sharing your solution with us. It seems to work very well.
-
AuthorPosts