jScrollPane contentPane在img src更改时不重新初始化

时间:2012-02-23 23:44:31

标签: jscrollpane

我的目标是将各种景观全景图像动态加载到jScrollPane容器中并重新初始化,以便根据当前的img尺寸重新计算滚动条。

我的问题是,虽然我正在注入img src然后调用api.reinitialise()方法,但它没有更新。因此img加载,但滚动窗格仍然是相同的宽度。

我认为它与jScrollPane有关,无法及时检索新的img维度,以正确的宽度重新初始化。

HTML

<div class="px-content">
    <img src="" />
</div>

JS

var scrollPane = $('.px-content').jScrollPane({hideFocus: true, showArrows: true, autoReinitialise: true});
var api = scrollPane.data('jsp');       

 var loadImage = function(id){
            var image, $paneContent, $img;
            imageSource= this.get(id); // returns an image URL



$paneContent = this.jspAPI.getContentPane();
        $img = $paneContent.find('img').attr('src', imageSource);
        api.reinitialise();
    }

loadImage(0); // loads correctly
loadImage(1); // loads img correctly, but pane doesn't refresh to new width

有什么想法吗?很高兴尝试任何事情。

的Seb。

0 个答案:

没有答案
相关问题