我期待用JScrollPane中的 “scrollToElement” API此功能:jQuery的JScrollPane中的scrollToElement
http://dextersgospel.com/index-test.html
说明它的使用可以在这里找到:
http://jscrollpane.kelvinluck.com/api.html#scrollTo
的问题,我与“stickToTop”的争论是一致的。当点击箭头,我想它带来的有针对性的DIV视口(不只是隐约可见,因为它是目前正在做)的顶部。 “stickToTop”参数应该是处理这个问题,但我无法让它工作。
我试图实现这个如下,但没有运气:
api.scrollToElement(target_div_id, {stickToTop: true});
,我已经试过:
api.scrollToElement(target_div_id, true);
这里是我当前全码:
$(function()
{
/* INITIALIZES jScrollPane on ENTIRE BROWSER WINDOW */
var win = $(window);
var isResizing = false;
var container = $('#full-page-container');
win.bind(
'resize',
function()
{
if (!isResizing) {
isResizing = true;
// Temporarily make the container tiny so it doesn't influence the
// calculation of the size of the document
container.css(
{
'width': 1,
'height': 1
}
);
// Now make it the size of the window...
container.css(
{
'width': win.width(),
'height': win.height()
}
);
isResizing = false;
container.jScrollPane(
{
'showArrows': false,
'mouseWheelSpeed': 75,
'contentWidth': 960, //So content doesn't jump around
'animateScroll': true,
'animateDuration': 600,
'hijackInternalLinks': true //HAD TO HAVE THIS FOR ANCHORS TO WORK!
}
);
}
}
).trigger('resize');
//Awesome scrollToY function for our duct tape arrows - no flicker + built w/jScrollPane
var api = container.data('jsp');
$('.proposal').bind(
'click',
function()
{
var target_div_id = '#' + $(this).attr("title"); // gives you the TITLE of the clicked link
api.scrollToElement(target_div_id, true);
return false;
}
);
});
任何关于如何得到JScrollPane中的“stickToTop”参数workfor了“scrollToElement”的方法是非常感激的帮助d!
绝对BRILLIANCE!非常感谢WTK。在这里,它的功能完全 - http://dextersgospel.com/index-test.html – nickff
很高兴帮助:)顺便说一句,你到达那里的好网站 - 去德克斯特! ;) – WTK
感谢兄弟! 5美元给你一本书的副本......只是说';) – nickff