1179 posts
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
mabuc says

Hello jquery masters,

I have a custom page loading like this
var $j = jQuery.noConflict();
$j(function() {
    var b = $j('#container').hide(); 
    $j(window).load(function() {
        b.fadeIn(1000);
        $j("#loading").hide();   
    });
}); 

and I have a scrollbar that goes like this

var $j = jQuery.noConflict();
$j(window).load(function() {
    mCustomScrollbars();
});

my problem is that scrollbar is not working because window.load() is called twice.. can anyone help me on what possible fix should I apply on this..

thank you in advance… :)

1681 posts Envato Elite Author
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
Tean says

Why dont you call mCustomScrollbars(); in your first $j(window).load(function() {...} block?

1148 posts
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
fillerspace says
I’m assuming the second window load function can’t be included in the first block because it will be written by a plugin or shortcode?
var $j = jQuery.noConflict();
$j(function() {
    var b = $j('#container').hide(); 
    $j(window).load(function() {
        b.fadeIn(1000);
        $j("#loading").hide();   
    });
}); 
$j(function() {
  $j(window).load(function() {
      mCustomScrollbars();
  });
});

This way worked for me (note that the second window load is wrapped in a $j() function)

1179 posts
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
mabuc says

Why dont you call mCustomScrollbars(); in your first $j(window).load(function() {...} block?
thanks for the help, I just made it this way:
$j(function() {
    var b = $j('#container').hide(); 
    $j(window).load(function() {        
        b.fadeIn(1000);
        $j("#loading").hide(); 
        mCustomScrollbars();      
    });
});

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by