bootbox.alert
应显示在bootbox.dialog
之前。我已经将所有库预加载到JSFiddle中。我希望bootbox.dialog
在bootbox.alert
被点击后显示。
答案 0 :(得分:1)
查看here
Bootbox定义了他们的函数here,正如您所看到的,它们包含一个回调函数。例如:
public class ReminderManager
{
private static final String TAG = ComponentInfo.class.getCanonicalName();
private Context mContext;
private AlarmManager mAlarmManager;
public ReminderManager(Context context)
{
mContext = context;
mAlarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
}
public void setReminder(Long taskId, Calendar when)
{
Log.d(TAG, "when: "+when);
Log.d("remindermanage", "rowid: "+taskId);
Intent i = new Intent(mContext, OnAlarmReceiver.class);
i.putExtra(RemindersDbAdapter.KEY_ROWID, (long)taskId);
PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, i, PendingIntent.FLAG_ONE_SHOT);
mAlarmManager.set(AlarmManager.RTC_WAKEUP, when.getTimeInMillis(), pi);
}
}
bootbox.alert(message, callback)
为您提供了在此行完成后仅运行某些代码的选项。这解决了你的问题。
<强> JS 强>
callback
答案 1 :(得分:0)
bootbox.alert
的第二个参数是function
,将在警报解除后调用。在该功能中启动对话框。
$(document).ready(function() {
$('.begin-game').click(function () {
bootbox.alert("This should show up first", showDialog);
function showDialog() {
bootbox.dialog({
message: "Did you pass Go?",
title: "This should go second / last",
buttons: {
// Passed go
success: {
label: "Yes I Passed GO!",
className: "btn-success",
callback: function() {
}
},
// Did not pass go
danger: {
label: "I did not :(",
className: "btn-danger",
callback: function() {
}
}
}
});
}
});
});