Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JScrollpane not showing

I've an issue with jscrollpane. When I load the web page, jscrollpane doesn't show but if I click one of the links of the page and then go back, jscrollpane is showing as it should.

The website is www.noved.info and the jscrollpane that is not showing is the one in section "casos de exito". If you click one of those links and then go back, you will see jscrollpane working. Jscrollpane is already working on the div above the mentioned.

Thanks in advance.

The code for the div not working is:

CSS:

.lista_exitos
{
    margin-left:5px;
    width:390px;
    height:400px;
    overflow:auto;
}

The HTML:

<div id="portfolio_container" class="contenedor_inferior" style="margin-left:7px;margin-top:5px;width:400px;height:413px;background-image:url(css-images/fondo_portfolio.png)">
    <div style="height:10px"></div>
    <div class="lista_exitos">
    <?php
    // PHP STUFF FOR GETTING DATA FROM DATABASE
         while ($fila = mysql_fetch_assoc($result))
         {
            echo '<p style="float:left;margin:0px;margin-left:5px;margin-bottom:5px"><a href="portfolio.php?id='.$id.'" alt="'.$nombre.'" style="margin-right:3px">
            <img src="imagenes/portfolio/'.$logo.'" width="180" border="0" align="absmiddle">
            </a></p>';
         }
    ?>
    </div>
</div>
<script type="text/javascript">
    $('.lista_exitos').jScrollPane();
</script>
like image 790
Juan Antonio Capel Avatar asked Jan 17 '26 00:01

Juan Antonio Capel


1 Answers

You have to get jScrollPane attached to a load event, otherwise it tries to apply itself to content before it has loaded. jScrollPane doesn't "see" the whole content, because the content hasn't loaded completely yet, and "thinks" that it's not needed. When you come back from another page, the entire content has loaded, and jScrollPane applies itself.

It all boils down to this:

<script type="text/javascript">
$(window).load(function() {
    $('.lista_exitos').jScrollPane();
}); 
</script>

I recommend using $(window).load wrapper whenever you use jScrollPane.

Hope this helps!

like image 96
Dimitri Vorontzov Avatar answered Jan 19 '26 14:01

Dimitri Vorontzov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!