I have created a bit of code to hide my menu, the menu is not complete but I am trying to use jQuery.slideUp()
function but it adds style="overflow: hidden;"
to the code so when I use .show one of my elements is hidden which is #nav:after
and #nav:before
which adds a small arrow to the bottom of the menu
here is the js code
$("span#start_button").click(function () {
if ($("#nav").is(":hidden")) {
$("#nav").show("fast");
} else {
$("#nav").slideUp();
}
});
and here is the result on this site
How can I stop .slideUp()
from creating style="overflow: hidden;"
?
I have created a bit of code to hide my menu, the menu is not complete but I am trying to use jQuery.slideUp()
function but it adds style="overflow: hidden;"
to the code so when I use .show one of my elements is hidden which is #nav:after
and #nav:before
which adds a small arrow to the bottom of the menu
here is the js code
$("span#start_button").click(function () {
if ($("#nav").is(":hidden")) {
$("#nav").show("fast");
} else {
$("#nav").slideUp();
}
});
and here is the result on this site
How can I stop .slideUp()
from creating style="overflow: hidden;"
?
5 Answers
Reset to default 17You must remove the overflow:hidden
on the callback of the slideUp()
function
so you can try
$("#nav").slideUp('fast', function(){ $('#nav').css('overflow','visible') });
Or you can force it by css
#nav{overflow:visible!important}
This is bug in older jquery. This code replace standart function "slideDown" and delete overflow property.
!(function (jQuery, origSlideDown) {
jQuery.fn.slideDown = function (speed, easing, callback) {
var self = this;
var args = Array.prototype.slice.call(arguments);
var origCallback;
for (var i = 0, len = args.length; i < len; i++) {
if (jQuery.isFunction(args[i])) {
origCallback = args[i];
args[i] = function () {
origCallback.call(this);
self.css('overflow', '');
}
}
}
if (!origCallback) {
args.push(function () {
self.css('overflow', '');
});
}
return origSlideDown.apply(this, args);
};
})(jQuery, jQuery.fn.slideDown);
Override that style -
$("#nav").slideUp();
$("#nav").css({'overflow':'visible'});
Try this...
else {
$("#nav").slideUp();
$("#nav").css("overflow","visible");
}
Override the default styling by modifying the style attribute of html.
else {
$("#nav").slideUp();
$("#nav").attr("style","overflow:visible");
}
animate()
instead. – gideon Commented Feb 1, 2013 at 12:52.slideUp()
function – LegendaryLaggy Commented Feb 1, 2013 at 12:56