The show() Method in jQuery is used to display the hidden and selected elements. Note: This method display the hidden elements which are using CSS display: none property. The elements are not visible whose visibility is hidden.
The display: inline-block Value Compared to display: inline , the major difference is that display: inline-block allows to set a width and height on the element. Also, with display: inline-block , the top and bottom margins/paddings are respected, but with display: inline they are not.
Instead of show
, try to use CSS to hide and show the content.
function switch_tabs(obj) {
$('.tab-content').css('display', 'none'); // you could still use `.hide()` here
$('.tabs a').removeClass("selected");
var id = obj.attr("rel");
$('#' + id).css('display', 'inline-block');
obj.addClass("selected");
}
Setting the CSS property after you have used .show()
should work. Maybe you are targeting the wrong element on your HTML page.
$('#foo').css('display', 'inline-block');
But if you are not using any effects of .show(), .hide()
why don't you set those CSS properties manually like:
$('#foo').css('display','none');
$('#foo').css('display','inline-block');
Use css() just after show() or fadeIn() like this:
$('div.className').fadeIn().css('display', 'inline-block');
I did that
function showPanels() {
$('.panels').show("slow");
$('.panels').css('display','inline-block');
}
works like a charm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With