在您的网站上发现了以下代码块:
// Prepare layout options.
var options = {
autoResize: true,
// This will auto-update the layout when the browser window is resized.
container: $('#main'),
// Optional, used for some extra CSS styling
offset: 40,
// Optional, the distance between grid items
itemWidth: 264 // Optional, the width of a grid item
};
// Get a reference to your grid items.
var handler = $('#tiles li');
// Call the layout function.
handler.wookmark(options);
所以每次更新列表时都要调用它..
JS:
function updateTable() {
var options = {
autoResize: true,
container: $('#main'),
offset: 40,
itemWidth: 264
};
var handler = $('#tiles li');
handler.wookmark(options);
}
$(document).ready(function() {
$('div[id*="chat-box-chats"]').hide();
updateTable();
$(".chat-box-textinput textarea").focus(function() {
$(this).parent().parent().find("#chat-box-chats").show();
updateTable();
});
$(".chat-box-textinput textarea").blur(function() {
$(this).parent().parent().find("#chat-box-chats").hide();
updateTable();
});
$(".chat-box-textinput").click(function() {
$(".chat-box-banner").show();
});
});
JsFiddle:演示| 资源
使用小提琴:http: //jsfiddle.net/apAAG/
编辑:
主页.js:
function updateTable() {
var options = {
autoResize: true,
container: $('#main'),
offset: 40,
itemWidth: 264
};
var handler = $('#tiles li');
handler.wookmark(options);
}
// bookmark stars
$(document).ready(function() {
$('#chat-box-chats').hide();
$('#nav-status-offline').hide();
$('.chat-box-banner').hide();
// hides the slickbox as soon as the DOM is ready
$(".chat-box-textinput").click(function(){
$("#chat-box-chats").show();
});
$("#nav-status").click(function(){
$("#nav-status-offline").show();
});
$("#nav-status").click(function(){
$("#nav-status").hide();
});
$("#nav-status-offline").click(function(){
$("#nav-status-offline").hide();
});
$("#nav-status-offline").click(function(){
$("#nav-status").show();
});
$(".chat-box-textinput").click(function(){
$(".chat-box-banner").show();
});
$('span.bookmark').click( function() {
$('span.bookmark').toggleClass("pushed");
$('span.bookmark img').toggleClass("noopacity");
});
$('textarea').each(function() {
// Stores the default value for each textarea within each textarea
$.data(this, 'default', this.value);
}).focus(function() {
// If the user has NOT edited the text clear it when they gain focus
if (!$.data(this, 'edited')) {
this.value = "";
}
}).change(function() {
// Fires on blur if the content has been changed by the user
$.data(this, 'edited', this.value != "");
}).blur(function() {
// Put the default text back in the textarea if its not been edited
if (!$.data(this, 'edited')) {
this.value = $.data(this, 'default');
}
});
});
$(document).ready(function() {
$('div[id*="chat-box-chats"]').hide();
updateTable();
$(".chat-box-textinput textarea").focus(function() {
$(this).parent().parent().find("#chat-box-chats").show();
$(this).parent().parent().find(".chat-box-banner").show();
$(this).addClass("big-textarea");
updateTable();
});
$(".chat-box-textinput textarea").blur(function() {
$(this).parent().parent().find("#chat-box-chats").hide();
$(this).parent().parent().find(".chat-box-banner").hide();
$(this).removeClass("big-textarea");
updateTable();
});
});