2013-11-18 4 views
0

Может ли кто-нибудь заметить, почему событие с кликом ShowVideo не срабатывает, чтобы открыть диалоговое окно JQueryUI? Я уверен, что это что-то относительно простое, что я пропускаю.JQuery - событие Click не работает

Вот соответствующий код моей страницы:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<title>Test</title> 
<link rel="Stylesheet" type="text/css" href="Styles/Site.css" /> 
<link href='http://fonts.googleapis.com/css?family=Raleway:400,600,900' rel='stylesheet' type='text/css' /> 
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> 
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script> 
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> 


<script type="text/javascript"> 
    $(document).ready(function() { 
     $(function() { 
      $("#dialog").dialog({ autoOpen: false }); //Hide the modal on page load. 
     }); 

     $("#ShowVideo").click(function() { 

      $("#dialog").dialog("option", "show", "slow"); // Should show the MF'ing dialog but never gets hit! 
     }); 
    }); 

    </script> 


</head> 
<body> 

     <h2Links</h2> 
     <ul class="SidebarMenu"> 
      <li id="ShowVideo">Test Popup</li> 
     </ul> 


    <div id="dialog" title="Test"> 

    <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p> 
</div> 



</body> 
</html> 

Быстрый JS скрипку, чтобы продемонстрировать: http://jsfiddle.net/Lnp9v/

+0

Отключить тему: у вас есть функции вложенной ready() по какой-либо причине. – isherwood

+0

Вы просто меняете опцию, не показываете диалог? – adeneo

+0

Спасибо Isherwood - копировать и вставлять вопрос я не заметил. Не знаете, почему вопрос был опущен, хотя - что с ним не так? –

ответ

4

Вы меняете вариант, а не "открыть" -ную диалог:

$("#dialog").dialog("open"); 

Обновлено Сценарий: http://jsfiddle.net/Lnp9v/4/

+0

Это было бы лучше, если бы вы сохранили «медленный» вариант. – isherwood

+0

@isherwood я сделал. Посмотрите на настройку диалога. –

+0

Это не переход в Chrome. – isherwood

1

Метод open.

$("#dialog").dialog("open"); 
Смежные вопросы