我正在尝试滚动到特定 div 容器的顶部。目前,我的代码正在将页面内容滚动到视图中。有人知道怎么回事吗?:) 这是代码:
var openItem;
var showBox = function(item) {
item.removeClass("loading");
var infoBox = $("div.test", item);
// Resize box
item.width(853);
item.height(infoBox.outerHeight());
// Reload Masonry
$('#container').isotope('reLayout');
// Insert close button
$('<a href="#" class="close">Close</a>"')
.prependTo(".test .content")
.click(function (e) {
e.preventDefault();
close(item);
});
// Insert close button
$('<a href="#" class="close">Close</a>"')
.appendTo(".test .content")
.click(function (e) {
e.preventDefault();
close(item);
});
// Fade in test box
setTimeout(function () {
testBox.fadeIn();
// Scroll box into view
$(document).scrollTo(item, 1000);
}, 280);
}