Tooltip/Popup: Improve video-player demo

This commit is contained in:
Jörn Zaefferer 2011-05-07 15:18:29 +02:00
parent f7e8331e26
commit a2674a2c6b

View File

@ -10,24 +10,34 @@
<script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script> <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.button.js"></script> <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script> <script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="../../ui/jquery.effects.core.js"></script>
<script type="text/javascript" src="../../ui/jquery.effects.blind.js"></script>
<script type="text/javascript" src="../../tests/visual/menu/popup.js"></script> <script type="text/javascript" src="../../tests/visual/menu/popup.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" /> <link type="text/css" href="../demos.css" rel="stylesheet" />
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
function notify( input ) { function notify( input ) {
var msg = "Selected " + $.trim($(input).text()); var msg = "Selected " + $.trim($(input).text());
$("<div/>").appendTo(document.body).text(msg).addClass("notification ui-state-highlight").position({ $("<div/>").appendTo(document.body).text(msg).addClass("notification ui-state-default ui-corner-bottom").position({
my: "center top+20", my: "center top",
at: "center top", at: "center top",
of: window of: window
}).delay(1000).fadeOut("slow", function() { }).show({
effect: "blind"
}).delay(1000).hide({
effect: "blind",
duration: "slow"
}, function() {
$(this).remove(); $(this).remove();
}); });
} }
$("ul").menu({ $("ul").menu({
select: function(event, ui) { select: function(event, ui) {
// stop button from handling the click // TODO stop button from handling the click
$(this).popup("close"); $(this).popup("close");
// TODO should probably be handled by poup, see ESCAPE key handler
// affects key handling
$(this).prev().focus();
notify(ui.item); notify(ui.item);
} }
}).popup(); }).popup();
@ -75,7 +85,7 @@
.set { display: inline-block; } .set { display: inline-block; }
.notification { position: absolute; display: inline-block; font-size: 2em; padding: 1em; border-radius: 15px; box-shadow: 2px 2px 5px -2px rgba(0,0,0,0.5); } .notification { position: absolute; display: inline-block; font-size: 2em; padding: .5em; box-shadow: 2px 2px 5px -2px rgba(0,0,0,0.5); }
</style> </style>
</head> </head>
<body> <body>