添加交叉浏览器jscrollpane不工作 [英] adding cross browser jscrollpane not working

查看:83
本文介绍了添加交叉浏览器jscrollpane不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我使用
更改默认滚动条,这是< a href =http://jsfiddle.net/4GP9c/275/ =nofollow> fiddle
在小提琴我写这个< div class = scroll-pane horizo​​ntal-only> (html部分中的行号122)更改默认滚动条,但如果我写这个,那么整个div消失。这个在使用jscrollpane之前显示。



这是jquery



  $(function()
{
$('scroll-pane')。
});

在js部分中的行号213,这是css

  / *特定于此特定页面的样式* / 
.scroll-pane
{
width:100%;
height:200px;
overflow:auto;
}
。仅限水平
{
height:auto;
max-height:200px;
}

css部分中的行号118


<因为@Era说jScrollpane有一个 height:0 ,它不会得到父的高度是在加载时隐藏的选项卡。



我更改了代码,使其只有在标签页可见后才会执行。

 < a id =userlinkhref =#tab2data-toggle =tab> Users< / a> 

$('body')。on('shown','#userlink',function(){
if(!$('。scroll-pane')。hasClass jspScrollable')){
$('。scroll-pane')。jScrollPane();
}
})

查看小提示


Hi I am using this to change the default scroll-bar and this is the fiddle In the fiddle I am writing this <div class="scroll-pane horizontal-only">(line number 122 in html section) to change the default scroll bar but If i write this then the whole div disappears.This shows before use of jscrollpane.

this is the jquery

$(function()
            {
                $('.scroll-pane').jScrollPane();
            });

Line number 213 in js section and this is the css

/* Styles specific to this particular page */
            .scroll-pane
            {
                width: 100%;
                height: 200px;
                overflow: auto;
            }
            .horizontal-only
            {
                height: auto;
                max-height: 200px;
            }

Line number 118 in the css section

解决方案

As @Era said jScrollpane is having a height: 0, it's not getting what the height of the parent is as the tab is hidden on load.

I changed the code such that it executes only after the tab is visible.

<a id="userlink" href="#tab2" data-toggle="tab">Users</a>

$('body').on('shown', '#userlink', function () {
    if(!$('.scroll-pane').hasClass('jspScrollable')) {
      $('.scroll-pane').jScrollPane();
    }
})

See fiddle

这篇关于添加交叉浏览器jscrollpane不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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