Enhacement of the OssNotifications Box window

Ondrej Janicko Posted in Theme Development 7 years ago

Hi,

I did enhacement of OssnNotifications Box window in GoBlue Theme. In current GoBlue theme is problem to dissapear and close the ossn notification window with simple click outside of notification window somewhere on desktop or browser window. I did enhacement that now you can click outside of notification window and notification window will disapear.

Just add these few lines at begining to /themes/goblue/plugins/default/js/goblue.php file:

//<script>
$(document).ready(function() {

$('body').click(function() {
  $('.ossn-notifications-box').click(function(){
    $('.ossn-notifications-box').show();
     });
  $('.ossn-notifications-box').hide();
 });


$('[data-toggle="tooltip"]').tooltip({
    placement:'left',                                       
}); 

...
etc.

This functionality should by added to official release of OSSN and GoBlue theme.

Only behavior which is not standard with this solution is that is needed sometimes to click twice to notification box window to show again. But it is minor problem that to have shown notification window still and have problem to close it.

Replies
Catalan Poonam Sehrawat Replied 7 years ago

What is the exact code we need to put and where. Can you please post your final code and exact position to put it so that the community can benefit. There are multiple codes posted here by you and we are not sure which one to use and where. Thanks.

Slovak Ondrej Janicko Replied 7 years ago

When this piece of code :

  $("body").click(function() {
      $(".ossn-notifications-box").hide();
     });

is written on the end of the function :

 $(document).ready(function() 

in /themes/goblue/plugins/default/js/goblue.php file

than closing notification window by clickin outside the notification window works like sharm.

No problem with twice clicking.

This piece of code should be definitely written in official OSSN distribution.

German Michael Zülsdorff Replied 7 years ago

Thanks for providing your idea, Ondrej.

And yes: This forum is in fact not a fully featured coding platform. To avoid any headaches you'll better do a pull request on Github.

Slovak Ondrej Janicko Replied 7 years ago

It should be also this:

$(document).ready(function() {

    $('body').click(function() {
      $('.ossn-notifications-box').hide();
     });


    $('[data-toggle="tooltip"]').tooltip({
        placement:'left',                                       
    });
Slovak Ondrej Janicko Replied 7 years ago

Problem with forum to show right code

The code in /themes/goblue/plugins/default/js/goblue.php file at beginning enter code hereis this:

    $(document).ready(function() {

        $('body').click(function() {
          $('.ossn-notifications-box').click(function(){
            $('.ossn-notifications-box').show();
             });
          $('.ossn-notifications-box').hide();
         });


        $('[data-toggle="tooltip"]').tooltip({
            placement:'left',                                       
        }); 
etc.