Response title
This is preview!
onSelect
callback. I toggle a custom class in the beforeShowDay
callback so there's a visual hint if the date is selected.beforeShowDay
code makes it all very slow (in my computer, 1 second in Firefox and 3 seconds in IE).+---------+
| Trigger |
+---------+
+-----------------------+
| |
| Box |
| |
+-----------------------+
moveIntoView = function(obj){
var pageWidth = $("body").width();
var objectWidth = $(obj).outerWidth();
var objectLeft = $(obj).offset().left;
if( objectLeft+objectWidth > pageWidth ){
$(obj).css({left: $(obj).offset().left + "px"}).animate({left: (pageWidth-objectWidth) + "px"}, "fast");
}
};
// Fetch data (GET method allows me to use browser cache)
$.get(url, get, function(jsonValues, txtStatus){
that.values = jsonValues;
}, "json");
// Create <select>
var select = document.createElement("select");
$(select).attr("disabled", "disabled");
$("<option>").attr("value", "").text("Loading...").appendTo(select);
// Populate <select>
$(that.values).each(function(i){
if(this.c!==null){
$("<option>").attr("value", this.c).text(this.v).appendTo(select);
}else{
// Informative item, must not be selectable
$("<option>").attr("value", "").text(this.v).attr("disabled", "disabled").appendTo(select);
}
});
$(select).removeAttr("disabled");
$(select).find("option:first-child").text("");
<!DOCTYPE html>
<title>location.replace should not create new history object</title>
<p><button onclick="location.replace('#test');">Set #test hash</button>
<p>#test should appear at the end of the URI but you should not be able to go to this page without #test as it should not create a new history object.
window.previousRow = null;
$("table#rows tbody tr[id^=row-]").click(function(){
var clickedRow = $(this);
if( !clickedRow.data("id") ){
clickedRow.data("id", clickedRow.attr("id").match(/^row-(\d+)$/i)[1]);
clickedRow.data("relatedData", $("div#relatedData-" + clickedRow.data("id")));
}
if( window.previousRow==null || window.previousRow.attr("id")!="row-" + clickedRow.data("id") ){
clickedRow.addClass("res");
if( window.previousRow != null){
window.previousRow.removeClass("res");
window.previousRow.data("relatedData").fadeOut("normal", function(){
clickedRow.data("relatedData").fadeIn("normal");
});
}else{
clickedRow.data("relatedData").fadeIn("normal");
}
window.previousRow = clickedRow;
// ?????
document.location.replace("#" + clickedRow.attr("id"));
}
});
$("div#foo").resize(repositionBox) // This does nothing
$("table tbody tr").click(function(){
// Do some stuff
});
$("table tbody tr a.remove").click(function(){
return confirm("Do you want to remove this row?");
});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script type="text/javascript"><!--
function toggleTables(){
$("table").slideToggle();
}
//--></script>
</head>
<body>
<p><input type="button" class="button" onclick="toggleTables()" value="Toggle Tables"></p>
<table border>
<tr>
<td>I'm a table</td>
</tr>
</table>
<table border>
<tr>
<td>I'm a table too</td>
</tr>
</table>
<table border height="150">
<tr>
<td>I'm a table with height attribute</td>
</tr>
</table>
</body>
</html>
$(function(){
$("table").each(function(){
var h = $(this).height();
$(this).attr("height", h);
$(this).css("height", h + "px");
$(this).height(h);
});
});
$(function(){
$("a[href=javascript:;]").addClass("no-existe");
});
a.no-existe{
cursor: url(../img/no-existe.cur), default;
}
127.0.0.3 - - [17/Dec/2008:14:17:35 +0100] "GET /img/no-existe.cur HTTP/1.1" 200 4286 "http://example.com/foo.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
127.0.0.3 - - [17/Dec/2008:14:17:35 +0100] "GET /img/no-existe.cur HTTP/1.1" 200 4286 "http://example.com/foo.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
127.0.0.3 - - [17/Dec/2008:14:17:35 +0100] "GET /img/no-existe.cur HTTP/1.1" 200 4286 "http://example.com/foo.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
127.0.0.3 - - [17/Dec/2008:14:17:35 +0100] "GET /img/no-existe.cur HTTP/1.1" 200 4286 "http://example.com/foo.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
127.0.0.3 - - [17/Dec/2008:14:17:35 +0100] "GET /img/no-existe.cur HTTP/1.1" 200 4286 "http://example.com/foo.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"
...........
© 2013 jQuery Foundation
Sponsored by and others.