Sindbad~EG File Manager
jQuery(document).ready(function() {
var window_w = jQuery(window).width(),
animated = 'animated-ltr';
var userAgent = navigator.userAgent;
jQuery.browser = {};
jQuery.browser.msie8 = /MSIE 8.0/.test(userAgent);
if (jQuery('html').attr('dir') == 'rtl') {
animated = 'animated-rtl';
}
if (window_w >= 980 || jQuery.browser.msie8) {
jQuery('.dropdown').hover(function() {
// Fit submenu items inside window
var max_width = 0;
jQuery(this).find('.dropdown-menu').each(function() {
if (jQuery(this).outerWidth() >= max_width) {
max_width = jQuery(this).outerWidth();
}
});
if (jQuery('html').attr('dir') == 'ltr') {
if ((window_w - jQuery(this).offset().left - jQuery(this).find('.dropdown-menu').length * max_width) < 0) {
animated = 'animated-rtl';
} else {
animated = 'animated-ltr';
}
} else if (jQuery('html').attr('dir') == 'rtl') {
if ((jQuery(this).offset().left - jQuery(this).find('.dropdown-menu').length * max_width) > 0) {
animated = 'animated-rtl';
} else {
animated = 'animated-ltr';
}
}
jQuery(this).find('.dropdown-menu').first().stop(true, true).addClass(animated);
}, function() {
jQuery(this).find('.dropdown-menu').first().stop(true, true).delay(50).queue(function(next) {
if (jQuery(this).hasClass('animated-ltr')) {
jQuery(this).removeClass('animated-ltr');
} else if (jQuery(this).hasClass('animated-rtl')) {
jQuery(this).removeClass('animated-rtl');
}
next();
});
});
jQuery('.dropdown-submenu').hover(function() {
jQuery(this).find('.dropdown-menu').first().stop(true, true).addClass(animated);
}, function() {
jQuery(this).find('.dropdown-menu').first().stop(true, true).delay(50).queue(function(next) {
if (jQuery(this).hasClass('animated-ltr')) {
jQuery(this).removeClass('animated-ltr');
} else if (jQuery(this).hasClass('animated-rtl')) {
jQuery(this).removeClass('animated-rtl');
}
next();
});
});
}
jQuery(window).resize(function() {
window_w = jQuery(window).width();
if (window_w < 980) {
jQuery('.dropdown').unbind('hover');
jQuery('.dropdown-submenu').unbind('hover');
} else {
jQuery('.dropdown .dropdown-menu, .dropdown-submenu .dropdown-menu').each(function() {
if (jQuery(this).hasClass('animated-ltr'))
jQuery(this).removeClass('animated-ltr');
else if (jQuery(this).hasClass('animated-rtl'))
jQuery(this).removeClass('animated-rtl');
});
jQuery('.dropdown').hover(function() {
// Fit submenu items inside window
var max_width = 0;
jQuery(this).find('.dropdown-menu').each(function() {
if (jQuery(this).outerWidth() >= max_width) {
max_width = jQuery(this).outerWidth();
}
});
if (jQuery('html').attr('dir') == 'ltr') {
if ((window_w - jQuery(this).offset().left - jQuery(this).find('.dropdown-menu').length * max_width) < 0) {
animated = 'animated-rtl';
} else {
animated = 'animated-ltr';
}
} else if (jQuery('html').attr('dir') == 'rtl') {
if ((jQuery(this).offset().left - jQuery(this).find('.dropdown-menu').length * max_width) < 0) {
animated = 'animated-ltr';
} else {
animated = 'animated-rtl';
}
}
jQuery(this).find('.dropdown-menu').first().stop(true, true).addClass(animated);
}, function() {
jQuery(this).find('.dropdown-menu').first().stop(true, true).delay(50).queue(function(next) {
if (jQuery(this).hasClass('animated-ltr')) {
jQuery(this).removeClass('animated-ltr');
} else if (jQuery(this).hasClass('animated-rtl')) {
jQuery(this).removeClass('animated-rtl');
}
next();
});
});
jQuery('.dropdown-submenu').hover(function() {
jQuery(this).find('.dropdown-menu').first().stop(true, true).addClass(animated);
}, function() {
jQuery(this).find('.dropdown-menu').first().stop(true, true).delay(50).queue(function(next) {
if (jQuery(this).hasClass('animated-ltr')) {
jQuery(this).removeClass('animated-ltr');
} else if (jQuery(this).hasClass('animated-rtl')) {
jQuery(this).removeClass('animated-rtl');
}
next();
});
});
}
});
});
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists