Last active
December 28, 2015 10:59
-
-
Save boertel/7489836 to your computer and use it in GitHub Desktop.
Hide red ribbon after 5 seconds
This file contains hidden or 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
| #rwd_tab { | |
| display: none !important; | |
| } | |
| #rwd_tab.shown { | |
| display: block !important; | |
| } |
This file contains hidden or 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
| window.ptReady = [] || window.ptReady; | |
| window.ptReady.push(function () { | |
| // Hide/Show the red ribbon | |
| function displayRedRibbon(display) { | |
| var redRibbon = document.getElementById("rwd_tab"); | |
| if (redRibbon) { | |
| redRibbon.className = display ? redRibbon.className + " shown" : redRibbon.className.replace(" shown", ""); | |
| } | |
| } | |
| // Wait until the ribbon is loaded | |
| PT.event.bind("rewardtab.ready", function () { | |
| var cookieName = "reward_ribbon_showed"; // Does the user already saw the ribbon? | |
| if (!PT.cookie.get(cookieName)) { | |
| displayRedRibbon(true); | |
| window.setTimeout(function () { | |
| displayRedRibbon(false); | |
| PT.cookie.set(cookieName, true) | |
| }, 5 * 1000); // wait 5 seconds before hiding the red ribbon | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment