Skip to content

Instantly share code, notes, and snippets.

@GabiGrin
Created March 7, 2018 08:02
Show Gist options
  • Save GabiGrin/a87845945224a67d3b4e652fae01dec8 to your computer and use it in GitHub Desktop.
Save GabiGrin/a87845945224a67d3b4e652fae01dec8 to your computer and use it in GitHub Desktop.
hide elements from specific articles, answers helpcenter sdk,=
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