2017-05-14 62 views
0

我想用jquery確認。請參閱下面的代碼和結果。結果與我們在網站上看到的不一樣。哪裏不對了?未能在jquery-confirm中設置寬度?

<!doctype html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <meta name="Generator" content="EditPlus®"> 
    <meta name="Author" content=""> 
    <meta name="Keywords" content=""> 
    <meta name="Description" content=""> 
    <title>Document</title> 
    <script src="../js/jquery-3.2.1.min.js"></script> 
    <link rel="stylesheet" href="../jquery-confirm-master/dist/jquery-confirm.min.css"> 
<script src="../jquery-confirm-master/dist/jquery-confirm.min.js"></script> 
</head> 
<body> 
<script> 
    $.alert({ 
    width :'auto', 
    title: 'Alert!', 
    content: 'Simple alert!' 
}); 
</script> 
</body> 
</html> 

the picture after running the code

回答

0

好像你需要添加以下,或只是嘗試添加引導。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.0.3/jquery-confirm.min.css"> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.0.3/jquery-confirm.min.js"></script> 
+0

這並沒有提供問題的答案。一旦你有足夠的[聲譽](https://stackoverflow.com/help/whats-reputation),你將可以[對任何帖子發表評論](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提問者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an- I-DO-代替)。 - [來自評論](/ review/low-quality-posts/18770724) – GGO

0

它工作正常,但如預期的,因爲你需要禁用引導主題,請參閱下面的代碼沒有顯示:

<script> 
    $.alert({ 
     width :'auto', 
     title: 'Alert!', 
     content: 'Simple alert!', 
     useBootstrap: false // Key line 
    }); 
</script> 

但是,如果你想使用引導主題,你應該包括以下在CDN鏈接你的文件。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.0.3/jquery-confirm.min.css"> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.0.3/jquery-confirm.min.js"></script>