4,114
edits
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
return list.width(); | return list.width(); | ||
}); | }); | ||
updateCommunityFeaturedPosition('block', '1'); | |||
// Insert the community featured element after the second card | // Insert the community featured element after the second card | ||
Line 33: | Line 35: | ||
} | } | ||
updateCommunityFeaturedPosition( | function updateCommunityFeaturedPosition(view, section) { | ||
// Hide all communityFeatured elements initially | |||
$('[id^="community-featured-"]').hide(); | |||
// Determine the appropriate communityFeatured element based on the current view and section | |||
var communityFeatured; | |||
// Determine | |||
var | |||
if (view === 'block') { | if (view === 'block') { | ||
communityFeatured = $('#community-featured-block-' + section); | |||
} else if (view === 'list') { | } else if (view === 'list') { | ||
communityFeatured = $('#community-featured-list-' + section); | |||
} | } | ||
// | // Position the appropriate communityFeatured element after the second card if it exists | ||
if ( | if (communityFeatured.length) { | ||
var filteredCards = communityFeatured.closest('.list-container').find('.filtered-list-item'); | |||
if (filteredCards.length >= 2) { | |||
communityFeatured.detach(); | |||
filteredCards.eq(1).after(communityFeatured); | |||
communityFeatured.show(); | |||
} | |||
} | } | ||
} | } |