• Resolved just0nequestion

    (@just0nequestion)


    What about the option of displaying a hide/close button like [x] or something like that above the ribbon?

    May you consider adding this feature to the plugin core?

    This way even big sized ribbons or adverts can be closed by the user if they collide with the content on lets say full-width pages and stuff.

    Quick hack:

    If you add this javascript code to the theme template or the custom html widget, the ribbon gets closed when the user clicks somewhere on the website except the ribbon area.

    <script>
             window.onload = function(){
                var hideribbon = document.getElementById('INSERT_NAME_OF_YOUR_RIBBON_DIV');
                document.onclick = function(e){
                   if(e.target.id !== 'INSERT_NAME_OF_YOUR_RIBBON_DIV'){
                      hideribbon.style.display = 'none';
                   }
                };
             };
          </script>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter just0nequestion

    (@just0nequestion)

    In all cases you have to replace INSERT_NAME_OF_YOUR_RIBBON_DIV with the class of your div! You can find or set the div id within the markup field in the show support ribbon settings page. <div id=”YOUR_NAME_OF_THE_DIV_CONTAINER” class=”buy-notd-discount” style=”{{css_div}}”>your ribbon text or image here</div>

    Another workaround until this option gets added to the plugin:

    Add a close / hide button or link to the show support ribbon plugin

    insert this within html widget or theme files

    <script>
       function closeribbon(boxid){
       document.getElementById(boxid).style.visibility="hidden";
    }
          </script>

    and add this code within the show support ribbon settings page in the markup field at the place where you want to display your hide button/link

    <a href="#" onclick="closeribbon('INSERT_NAME_OF_YOUR_RIBBON_DIV');">hide ribbon</a><br/>

    Please let me know if you like this workaround ??

    Plugin Author Jeff Starr

    (@specialk)

    Thanks for sharing this, @just0nequestion. I’ll take a closer look and see about adding something in a future plugin update. In the meantime, feel free to share any other ideas, feedback, etc. I’m sure it will be useful to any others who would benefit from similar functionality. Cheers ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add a close/hide button to support ribbon plugin?’ is closed to new replies.