Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/manyatee/www/manyatee-com/wp/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 77

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/manyatee/www/manyatee-com/wp/wp-content/plugins/jetpack/_inc/lib/class.media-summary.php on line 87

Warning: count(): Parameter must be an array or an object that implements Countable in /home/manyatee/www/manyatee-com/wp/wp-includes/post-template.php on line 284

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'custom_excerpt_length' not found or invalid function name in /home/manyatee/www/manyatee-com/wp/wp-includes/class-wp-hook.php on line 298

「Live floating menu」小技。

備忘録。 メニューを固定位置に追随させるjQueryプラグイン「Live floating menu」の小技。 「ある程度(例:縦280 px分)スクロールしてから、追随しだす方法。」
#floatMenu {position:absolute;top:280px;left:30px;}
var name = "#floatMenu";
var menuYloc = null;
$(document).ready(function(){
menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
$(window).scroll(function () {
if($(window).scrollTop() > menuYloc) {
offset = -280 + menuYloc+$(document).scrollTop()+"px";
$(name).animate({top:offset},{duration:500,queue:false});
}
else{
$(name).animate({top:280},{duration:500,queue:false});
}
});
});
|


コメントを残す


]