开发者

JavaScript error with Tiny Scrollbar

I added TinyscrollBar to my Wordpress site, and I'm getting the following error when the page loads:

oViewport.obj[0] is undefined

I made sure that I first included the tinyscrollbar.js file, and only then do I make the call

                if (jQuery('#execphp-3 div')){
                    jQuery('#execphp-3 div').tinyscrollbar();
            }

What could be the problem that's causing the error?

EDIT: The HTML that the tinyscrollbar is running on:

<li class="widget-container widget_execphp" id="execphp-3">
         <h3 class="widget-title">Talking NanoChannels</h3>         
     <div class="execphpwidget">
        <div id="scrollbar1">
           <div class="scrollbar" style="height: 347px;">
                     <div class="track" style="height: 347px;">
                        <div class="thumb" style="top: 90.8106px; height: 256.189px;">
                           <div class="end">
                           </div>
                        </div>
                     </div>
           </div>
           <div class="viewport">
                <div class="overview" style="top: -123px;">
                    <ul class="wrap masoned" id="simplepie" style="position: relative; height: 683px;">                
                        <li title="" class="box col1" style="position: absolute; left: 0px; top: 0px;">                    
                            <h4>                        
                               <span class="twitter"></span>
                               <a href="http://twitter.com/EreiItamisy/statuses/87518699866701825">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5th International Conference on Nanochannels, Microchannels, and Minichannels: Puebla, Mexico - June 18-20, 2007: http://amzn.to/jutpBp</a>                                                                                                                       </h4>                    
                             <span class="corner"></span>               
                        </li>                
                    </ul>
                </div>
           </div>
        </div>
     <开发者_JAVA技巧;/div>
</li>


Just want to add: dont forget to add "scrollbar" and "viewport" elements inside the scrollable content as that can triger the same error.

Cheers!


You probably want something like this:

if (jQuery('#execphp-3 div#scrollbar1')) 
{ 
   jQuery('#execphp-3 div#scrollbar1').tinyscrollbar();
}


please re init your scroll then it will work fine when page loaded in is

$('#scrollbar1').tinyscrollbar_update();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜