Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Jquery expand Re: Jquery expand

#120913
wragen22
Member

@Mottie I’ve added back in the .promise().done so you can see what i’m going for. I’m still having issues getting the background color to expand the whole 100% width of the page..hence my weird markup before. Because of this..I think I may not be able to use the ordered list, epsecially if I want to do some formatting and margins of the numbering and titles. I also added a fadeToggle on the right buttons..but just not sure how to tie it in with the left paragraph. http://codepen.io/wragen22/pen/Fjesr

$(function(){

$(‘.grid p, .grid .right-module’).hide();
$(‘.grid h1’).addClass(‘pointer’).click(function() {
var $article = $(this).closest(“.grid”),
$siblings = $article.find(“p,.right-module”)
if ($article.hasClass(‘expanded’)) {
$siblings.slideToggle(‘slow’).promise().done(function() {
$article.removeClass(‘expanded’);
});
} else {
$article.addClass(‘expanded’);
$siblings.slideToggle(‘slow’);
}
});

});