Giter Club home page Giter Club logo

jquery-toast-plugin's People

Contributors

akram-rameez avatar bitdeli-chef avatar bryant1410 avatar imranjs avatar jasonday avatar kamranahmedse avatar mahadazad avatar martin-nyaga avatar mazyvan avatar n3gotium avatar stephen9s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery-toast-plugin's Issues

options.hideAfter not respected when calling update

If, when creating the toast, hideAfter is set to false and a subsequent call to update specifies a non-false value for hideAfter, the toast will not automatically close after the specified amount.

For example:

var toast = $.toast({
            text: 'doing something',            
            position: 'top-center',
            allowToastClose: false,
            hideAfter: false
});

// do someothing that takes some time

toast.update({
           text: 'done',
           hideAfter: 2000
});

My use case is for saving data. I initially show a "Saving..." message when the save starts, and then I update the message "Save successful" when it completes. The original message should stay up until the latter changes it, however the latter should disappear after a bit.

Do we need to add .editorconfig

Hello, many thanks for the nice plugin.

Do we need to add editor conf to specify some rules, eg. trim_trainling_whitespace = true

Wrong 'afterHidden' function work when many toasts

When on page is more than one toast , parameter 'afterHidden' wrong working. When closing any toast, function 'checkMessage' run with last param.id. Example
for (var ind=0;ind<cnt;ind++) {
var param = fldJson.params[ind] ;
jQuery.toast({
,heading:param.messageTitle
,text:param.messageText
,hideAfter: false
,afterHidden: function () {checkMessage(param.id);} //example: 1,2,3,4
});
}
//when close toast, it will run with same parameter:
checkMessage(1);
checkMessage(1);
checkMessage(1);
checkMessage(1);

display variable as text?

Hi,
Is it possible to display the content of a string variable as text in the toast?

var string_variable = "this is my dynamic text";

$.toast({
text : " $('string_variable').val()"
}

greetings

$.toast is not a function

<script src="~/Scripts/jquery-3.4.1.js"></script> <script src="~/Scripts/Toast/jquery.toast.min.js"></script> <script> $(document).ready(function () {
    $("#toast").on('click', function () {
        $.toast({
            heading: 'Information',
            text: 'Now you can add icons to generate different kinds of toasts',
            showHideTransition: 'slide',
            icon: 'info'
        })
    });
});
</script>

Tag newest version

Hello,

can you please tag the newest version so the latest changes will be updated within my package.json?
The last update was for having the a11y attributes

Thank you! @kamranahmedse

Duplicate Toasts

Is there a possible way to check if the new toast triggering already exists, if so then stop the new one.

Trying to make it work with AMD Shim/ RequireJS/ TypeScript

Recently trying to use it with TypeScript and RequireJS+Shim ... however there's no Toast.s.ts defiend for it, and it depends on JQuery ... hence trying to get support for this, or I'll try to implement the missing pieces ...

Property 'toast' does not exist on type 'JQueryStatic'.

Cannot read property 'opts' of undefined with fancybox3 SOLVED

I have next code:

$.toast({
    text: "Don't forget to star the repository if you like it.", // Text that is to be shown in the toast
    heading: 'Note', // Optional heading to be shown on the toast
    icon: 'warning', // Type of toast icon
    showHideTransition: 'fade', // fade, slide or plain
    allowToastClose: true, // Boolean value true or false
    hideAfter: 3000, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden
    stack: 5, // false if there should be only one toast at a time or a number representing the maximum number of toasts to be shown at a time
    position: 'bottom-left', // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values
    textAlign: 'left',  // Text alignment i.e. left, right or center
    loader: true,  // Whether to show loader or not. True by default
    loaderBg: '#9EC600',  // Background color of the toast loader
    beforeShow: function () {}, // will be triggered before the toast is shown
    afterShown: function () {}, // will be triggered after the toat has been shown
    beforeHide: function () {}, // will be triggered before the toast gets hidden
    afterHidden: function () {}  // will be triggered after the toast has been hidden
});

And i get next error with fancybox3. How fix this?

jquery.fancybox.js:4821 Uncaught TypeError: Cannot read property 'opts' of undefined
    at HTMLDocument.beforeShow.fb (jquery.fancybox.js:4821)
    at HTMLDocument.dispatch (jquery.min.js:3)
    at HTMLDocument.q.handle (jquery.min.js:3)
    at Object.trigger (jquery.min.js:4)
    at HTMLDivElement.<anonymous> (jquery.min.js:4)
    at Function.each (jquery.min.js:2)
    at r.fn.init.each (jquery.min.js:2)
    at r.fn.init.trigger (jquery.min.js:4)
    at Object.animate (jquery.toast.min.js:1)
    at Object.process (jquery.toast.min.js:1)

Installation instructions

I think the installation instructions could be a bit more detailed or at least reference to external resources. For those of us starting out it isn't so clear how to set it up. I've been trying to install it for an hour now with no success. Perhaps a response to this post might suffice as well.

Thanks in advance.

z-index issue

I'm using the toast in a project together with bootstrap. sometimes the toast gets hidden behind form elements on the page. maybe a higher z-index would help?

(I fixed my issue by overwriting the z-index for .jq-toast-wrap )

Consecutive calling with different position values

The position attribute on the call makes it feel like it can be placed at different position. But when I make a call, it seems the first position wins and all future toast are put at the same place.

Is this intentional or a bug?

If intentional, it seems like it would be better served to have a $.toast.init({...}) function.

Tag newest version

Can you please tag the newest version so the latest changes will be updated within my package.json?

Click on toast

Hi there, is it possible to bind a click event on the toast? Would be nice!

Change title or translation of the alert

Please,

As I can change or translate title of alert?
When I showed a error message, the title is "Danger" but the language of app in portuguese.

I don't know as change it and not found in documentation and examples.
Anyone can help me?

Thanks!

Not working with angularJs

I am using AngularJs and I want to use this toast. But it is working only for the first time, after that when I try to use it, it shows $.toast is not a function.
angular.js:13550 TypeError: $.toast is not a function at showmsg (proofingHome.js:9) at proofingHome.js:280 at angular.js:15961 at n.$eval (angular.js:17229) at n.$digest (angular.js:17045) at n.$apply (angular.js:17337) at l (angular.js:11572) at H (angular.js:11778) at XMLHttpRequest.u.onload (angular.js:11711)

Width of toast

Hi, exist a way to change de width of a toast ?

If exist, how i can do it ?

Thank´s

toast shows for very less time while using in submit

Hello I'm a new coder i am using this plugin for form submission whenever the form is submitted the toast appears for a small amount of time and then the page reloads automatically after submit please help
following is my code:
$(document).ready(function(e) {

$("#form").submit(function (e) {

$.toast({
text: "User Registered",
heading: 'Admission Successful',
icon: 'success',
showHideTransition: 'fade',
allowToastClose: true,
hideAfter: false, 
stack: false, 
position: 'mid-center', 
});

});

});

thanks in advance

hideAfter - after update not working

Hi. Nice job.
Please add this.animate() to update function (line 326) to allow "disappearing" after update.
Rg
Ja(cek)

  update: function(options) {
            this.prepareOptions(options, this.options);
            this.setup();
            this.bindToast();
            this.animate();   // --> requested change
        },

Don't hide toast on hover or touch

I'd like to add a feature that even if a time out to hide the toast has been set, a hover or touch event will keep it visible for the entire event duration and the countdown will only start after the event has ended. Is this project actively maintained or should I just fork and modify?

Toast goes outside of the window when set to top-right with icon

When toast is created without icon set to top-right position, it looks perfect but when an icon (success, warning or any other icon) is added some part of the rendered toast goes outside of the window. I have tested this on firefox and chrome.
To reproduce, on demo page: https://kamranahmed.info/toast
Try section 7 "Positioning the toast" with top-right position and it works fine, then try section "Customize Plugin" with position set to top-right given an icon, it looks like this.

image

Maybe the right thing to do would be setting "right" position to 75px instead of 40px in ".jq-toast-wrap.top-right" and change padding of ".jq-toast-single" to 30px right and left side each. Change would look like this

image

Feature Request: Specify a width of the toast

I believe there should be a few inbuilt widths:

  • full
  • small (default)
  • half
  • number (this would be a custom amount the user specifies in px) eg 100 or "100px"
  • percentage (this would be a custom amount the user specifies in %) eg "100%"

An example:

$.toast({
    heading: 'Testing',
    text: `This is a width test half`,
    width: 'half'
})

$.toast({
    heading: 'Testing',
    text: `This is a width test full`,
    width: 'full'
})```

can we keep the old sticky toasts still if current toasts are more than the stack number?

If I run the below script for more than 4 times, like 5 or 10:
$.toast({ text: 'Set the hideAfter property to false and the toast will become sticky.', hideAfter: false, stack: 4, })
The old one will be replaced by the new one, however, when I close all the 4 toasts, I didn't see the old toasts, should we set them as sticky until clicking the close button?
for example, the latest toast will not replace the previous one, just have a larger z-index, after closing the latest toast, we still can see the previous one.

Update request for new Bootstrap 4.2.1

Hi Kamran,
Thank you for your Plugin, it's very useful to display the Toaster after an AJAX Call to a Web Service.

I have to report to you a conflict with the New Bootstrap 4.2.1 (updated on 21 Dec 2018)

$('#element').toast('show');

  • I would like to suggest a new release of Jquery Toast Plugin for having the 100% compatibility with Bootstrap 4, just like using $().toaster()
  • I'm still using your Plugin in my Web app.
  • But probably Bootstrap will release several new implements and features in the next months

Let me know if you need some help.
Thank you for the work, I appreciate it a lot!
Best
Wen-Long (Italy)
@thun88

Pause timer on hover

Is there a option to pause the timer on mouseover the toast? And continue timer when mouseleave?

This is useful feature when you have some clickables options on toast and user needs to choose.

Want 'prepend' option

Hello.

I like that this plugin can set several toast positions. But when I set position : 'top-right', the newest toast is shown below the old one, and sometimes the newest toast will overflow the viewport.

I'd suggest prepend option. Currently this plugin always append to $('.jq-toast-wrap'), but if we have an option like prepend: true and have below code, the newest toast can always be shown at top-right in viewport.

if (_options.prepend) {
   _container.prepend( this._toastEl );
} else {
   _container.append( this._toastEl );
}

I'd like to have this feature in this plugin.
Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.