How to Automatically Close Alerts using Twitter Bootstrap

Calling window.setTimeout(function, delay) will allow you to accomplish this. Here’s an example that will automatically close the alert 2 seconds (or 2000 milliseconds) after it is displayed. $(“.alert-message”).alert(); window.setTimeout(function() { $(“.alert-message”).alert(‘close’); }, 2000); If you want to wrap it in a nifty function you could do this. function createAutoClosingAlert(selector, delay) { var alert = $(selector).alert(); … Read more

Twitter Bootstrap alert message close and open again

Data-dismiss completely removes the element. Use jQuery’s .hide() method instead. The fix-it-quick method: Using inline javascript to hide the element onclick like this: <div class=”alert” style=”display: none”> <a class=”close” onclick=”$(‘.alert’).hide()”>×</a> <strong>Warning!</strong> Best check yo self, you’re not looking too good. </div> <a href=”#” onclick=”$(‘alert’).show()”>show</a> http://jsfiddle.net/cQNFL/ This should however only be used if you are lazy … Read more

Animate a custom Dialog

I’ve been struggling with Dialog animation today, finally got it working using styles, so here is an example. To start with, the most important thing — I probably had it working 5 different ways today but couldn’t tell because… If your devices animation settings are set to “No Animations” (Settings → Display → Animation) then … Read more

Swift alert view with OK and Cancel: which button tapped?

If you are using iOS8, you should be using UIAlertController — UIAlertView is deprecated. Here is an example of how to use it: var refreshAlert = UIAlertController(title: “Refresh”, message: “All data will be lost.”, preferredStyle: UIAlertControllerStyle.Alert) refreshAlert.addAction(UIAlertAction(title: “Ok”, style: .Default, handler: { (action: UIAlertAction!) in print(“Handle Ok logic here”) })) refreshAlert.addAction(UIAlertAction(title: “Cancel”, style: .Cancel, handler: … Read more

How do I make a Mac Terminal pop-up/alert? Applescript?

Use osascript. For example: osascript -e ‘tell app “Finder” to display dialog “Hello World”‘ Replacing “Finder” with whatever app you desire. Note if that app is backgrounded, the dialog will appear in the background too. To always show in the foreground, use “System Events” as the app: osascript -e ‘tell app “System Events” to display … Read more

Disable Monit alerts when PID changed

You can disable this alert by setting up a local alert statement. This is thoroughly documented here: http://mmonit.com/monit/documentation/monit.html#setting_a_local_alert_statement This should do it: check process blop with pidfile /…/blop.pid alert recipient@address.com but not on { pid } start program = “…” stop program = “…”

Bootstrap Alert Auto Close

For a smooth slide-up:- $(“#success-alert”).fadeTo(2000, 500).slideUp(500, function(){ $(“#success-alert”).slideUp(500); }); $(document).ready(function() { $(“#success-alert”).hide(); $(“#myWish”).click(function showAlert() { $(“#success-alert”).fadeTo(2000, 500).slideUp(500, function() { $(“#success-alert”).slideUp(500); }); }); }); <link rel=”stylesheet” href=”https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css” integrity=”sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T” crossorigin=”anonymous”> <div class=”product-options”> <a id=”myWish” href=”javascript:;” class=”btn btn-mini”>Add to Wishlist </a> <a href=”” class=”btn btn-mini”> Purchase </a> </div> <div class=”alert alert-success” id=”success-alert”> <button type=”button” class=”close” data-dismiss=”alert”>x</button> <strong>Success! </strong> … Read more

How to change theme for AlertDialog

In Dialog.java (Android src) a ContextThemeWrapper is used. So you could copy the idea and do something like: AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom)); And then style it like you want: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <style name=”AlertDialogCustom” parent=”@android:style/Theme.Dialog”> <item name=”android:textColor”>#00FF00</item> <item name=”android:typeface”>monospace</item> <item name=”android:textSize”>10sp</item> </style> </resources>