上午所有,開放jQuery的彩盒從ASP.NET MVC部分
我有一個ASP.Net MVC應用程序,並在頁面上的一個我有上有按鈕,通過AJAX加載表格打開'詳細信息'colorbox。我綁定了所有按鈕以在頁面加載中使用jQuery顏色框插件,但是當我重新加載表格時,這些按鈕不再起作用,因爲它們需要重新綁定。因此我打算直接調用colorbox。
我有以下代碼:
<td><button class="button" type="button" onclick="$.colorbox({href:"@Url.Action("ShowReviewFeedbackDetails", "Review", new { reviewFeedbackId = reviewfeedback.ReviewId, subjectId = reviewfeedback.SubjectArea.Id })", transition: "elastic", iframe: true, overlayClose: true, width: 650, height: 400, scrolling: false});">Details</button></td>
當我點擊按鈕,我得到一個JavaScript語法錯誤。我也得到了錯誤,如果我刪除的助手,只是硬編碼的URL,例如:
<td><button class="button" type="button" onclick="$.colorbox({href:"www.google.com", transition: "elastic", iframe: true, overlayClose: true, width: 650, height: 400, scrolling: false});">Details</button></td>
顏色框上工作的其他網頁得很好,我沒有重裝動態調用它們不過他們只是有按鈕colorBoxStd
作爲一個階級和我使用內$(document).ready
$(".colorBoxStd").colorbox({ transition: "elastic", iframe: true, overlayClose: true, width: 650, height: 400, scrolling: false });
任何想法,這個代碼將不勝感激,因爲我拉我的頭髮用這個..
感謝, Ĵ
在jQuery中捕獲按鈕單擊事件並從那裏調用colorbox。給你更多的調試選項 – Ivo