我正在编辑一个使用YUI框架的PHP脚本。 我添加了一个jQuery脚本片段来浮动侧边栏元素。脚本如下:
$(document).ready(function() {
var $scrollingDiv = $("#rightcategoryBar"); //scrolling div
var position = $("#stopScroll").position(); // div before you want to stop
var height = $("#rightcategoryBar").height(); //scrolling div can have dynamic height
var pos = position.top - (height + 200); //adding some value so it wont stop very closely
$(window).scroll(function(){
if($(window).scrollTop() > 8 && $(window).scrollTop() < pos){ //8 is value after it start moving when scrooling
$scrollingDiv
.stop()
.animate({"paddingTop": ($(window).scrollTop() - 10) + "px"}, "slow" ); //10 is value that div appear at the top of the window
}
});
});
但是当我使用两者时,一些YUI不起作用。我也试过了$noConflict()
。有人可以指导我解决问题吗?