How to adjust toaster popup width

fgonzalez picture fgonzalez · Jan 21, 2015 · Viewed 25.8k times · Source

I'm using AngularJS-Toaster to popup notifications in my app. For the frontend I'm using bootstrap.

Using the class 'container' I have a grid of 1200px. Inside I have a div with the popup notifications.

I would like to adjust the width of the popup notification to the same width that the container where this toaster is included in. I saw that toaster has a parameter 'position-class' to change the position and even the width of the popup, like for example 'toast-top-full-width', but using that I get a full screen notification, it is not adjusting to the container where it is included. I guess this is something that could be done using Css, but how? Could you please help me?

Here my html code:

<body data-ng-controller="AppController">


    <div id="container" class="container">

   <toaster-container toaster-options="{'position-class': 'toast-container','time-out': 3000, 'close-button':true}"></toaster-container>

        <div id="header" data-ng-include="'partials/header/header.html'" ></div>



        <div data-ng-view></div>
        <div id="footer" data-ng-include="'partials/footer/footer.html'"></div>


        <div id="loader" class="loading overlay" data-ng-if="loader.loading">
            <p>We are loading the products. Please wait...</p>
            <img alt="" src="images/ajax-loader.gif">
         </div>   

    </div>

    <div id="loginPanel" data-ng-include="'partials/content/panels/login.html'"></div>

Thank you very much in advance.

Answer

sylwester picture sylwester · Jan 21, 2015

You can change class for your toaster to toast-top-full-width

 <toaster-container toaster-options="{'time-out': 3000, 'close-button':true, 'position-class':'toast-top-full-width'}"></toaster-container>

OR you can create custom css rule and apply it to your toaster ie.

  <toaster-container toaster-options="{'time-out': 3000, 'close-button':true, 'position-class':'my-toast-class'}"></toaster-container>

Check example :- http://plnkr.co/edit/1nZygN?p=preview