Created
March 7, 2018 08:02
-
-
Save GabiGrin/a87845945224a67d3b4e652fae01dec8 to your computer and use it in GitHub Desktop.
hide elements from specific articles, answers helpcenter sdk,=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hideComponents() { | |
$('.search-box').hide(); // hides search | |
$('.breadcrumbs').hide(); // hides breadcrumbs | |
} | |
answersSdk.onLoad(function () { | |
var articleIds = [ | |
'1ad262da-d909-11e7-9296-cec278b6b50a', | |
'1ad26578-d909-11e7-9296-cec278b6b50b', | |
'1ad268de-d909-11e7-9296-cec278b6b50c', | |
'1ad26a28-d909-11e7-9296-cec278b6b50d' | |
]; | |
answersSdk.addListener(answersSdk.events.pageLoad, function (eventData) { | |
if (eventData.pageType === answersSdk.pages.article) { | |
var shouldHideComponents = articleIds.indexOf(answersSdk.getVisiblePageItemId()) !== -1; | |
if (shouldHideComponents) { | |
hideComponents(); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment