I have two sets of promoted link tiles. I've placed each set of tiles in their own webpart on a webpart page.
What I would like to do is:
1. Hide the second set of tiles, and
2. Reveal the second set of tiles when the first link of the first set is clicked,
3. Hide the second set again, when the first link of the first set is clicked again (this is optional, though).
Essentially, I want to toggle webpart2, when link1 of webpart1 is clicked.
This is the code that I have in a CEWP. It hides webpart2 correctly, but won't reveal when I click the other link the first link in webpart1.
<script type="text/javascript" src=".../.../SiteAssets/jquery-2.1.3.min.js"></script>
<script language="javascript">
$(document).ready(function() {
$("div#promotedlinksbody_WPQ3").hide();
});
$(function () {
$("a[id^=Tile_WPQ]").each(function () {
$(this).click(function () {
var linkTitle = $(this).find('li[title]').attr('id');
if (linkTitle == "Tile_WPQ2_1_1")
{
$("div#promotedlinksbody_WPQ3").show();
event.returnValue = false;
}
});
});
});
</script>
What am I doing wrong?