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… :)

1677 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();      
    });
});
by
by
by
by
by
by