how can I display messages right to left in noty plugin

878 Views Asked by At

I am using noty

how can I display messages right to left or change text align in 'noty_message' class

thanks

1

There are 1 best solutions below

0
On

You can do that by having a customized theme.

This is how to create your own theme for Noty:

  1. First duplicate the default theme file which should be named default.js or relax.js or bootstrap.js under noty/themes/. Name the duplicate whatever you want and include the file in your HTML page.
  2. Open the duplicate and do the following changes:
    • Search for "defaultTheme" and replace it with your own theme name. Do this on the whole code.
    • Search for this.$message.css({fontSize: '11px', textAlign: 'left'}); and change "left" to "right".
  3. On calling Noty in your main HTML page, specify the theme name you picked before like this:
    • noty({text: 'Successful action', layout: 'topRight', type: 'success', theme: 'myThemeName'});

I have tested it for version 2.2.7 and it worked well.