4,114
edits
No edit summary |
No edit summary |
||
Line 33: | Line 33: | ||
} | } | ||
updateCommunityFeaturedPosition('block', '1'); | |||
// Update the positioning and visibility of community featured elements based on view and section | |||
function updateCommunityFeaturedPosition(view, section) { | function updateCommunityFeaturedPosition(view, section) { | ||
// | // Initially hide all community featured elements | ||
$(' | $('#community-featured-block-1, #community-featured-block-2, #community-featured-block-3, #community-featured-list-1, #community-featured-list-2, #community-featured-list-3').hide(); | ||
// Determine | // Determine which community featured element to show based on the current view and section | ||
var | var communityFeaturedElement; | ||
if (view === 'block') { | if (view === 'block') { | ||
communityFeaturedElement = $('#community-featured-block-' + section); | |||
} else if (view === 'list') { | } else if (view === 'list') { | ||
communityFeaturedElement = $('#community-featured-list-' + section); | |||
} | } | ||
// | // Show and position the appropriate community featured element if it exists | ||
if ( | if (communityFeaturedElement.length && filteredCards.length >= 2) { | ||
communityFeaturedElement.detach(); | |||
filteredCards.eq(1).after(communityFeaturedElement); | |||
communityFeaturedElement.show(); | |||
} | } | ||
} | } |