使iscroll在动态加载div时工作 [英] making iscroll to work when loading a div dynamically

查看:133
本文介绍了使iscroll在动态加载div时工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以用一个例子来解释,如果可能的话,如何加载一个iscroll div内的动态内容并为它分配一个新的高度?



我可以得到它工作,但我无法控制新内容的滚动的高度。



我是新来的,没有任何线索开始。 p>

这是我正在做的工作:



http://homepage.mac.com/jjco/test/index7.html



当页面为加载你看到没有内容的滚动条...
点击打印/ damm(显示我最初为此内容设置的高度)
点击打印/ fcbarcelona(保持相同的高度和位置你以前使用的滚动),因为你看到它不工作,因为它应该。
显然,我不想滚动到那里,当没有必要。



任何帮助将不胜感激。

解决方案

在iScroll中使用refresh()方法,它将重新计算高度。

  myScroll.refresh(); 


can anyone please explain, with an example if possible, how to load dynamic content inside an iscroll div and assign a new height to it?

I can get it to work but I can't control the height of the scroll for the new content.

I'm new to all this and have no clue were to start.

here's what I'm working on:

http://homepage.mac.com/jjco/test/index7.html

when the page is loaded you see the scroll bar where there's no content... clicking on print/damm (shows the height I originally set for this content) clicking on print/fcbarcelona (maintains the same height and position of the scroll you used before) as you see it's not working as it should. obviously, I don't want the scroll to be there when it's not necessary.

any help would be greatly appreciated.

解决方案

It's better to use the refresh() method in iScroll, which will recalculate the height.

myScroll.refresh();

这篇关于使iscroll在动态加载div时工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆