control/plugin/smint/jquery.smint.js
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
SMINT V1.0 by Robert McCracken
SMINT is my first dabble into jQuery plugins!
If you like Smint, or have suggestions on how it could be improved, send me a tweet @rabmyself
*/
(function () {
$.fn.smint = function (options) {
// adding a class to users div
$(this).addClass('smint')
var settings = $.extend({
'scrollSpeed ': 500
}, options);
return $('.smint a').each(function () {
if (settings.scrollSpeed) {
var scrollSpeed = settings.scrollSpeed
}
///////////////////////////////////
// get initial top offset for the menu
var stickyTop = $('.smint').offset().top;
// check position and make sticky if needed
var stickyMenu = function () {
// current distance top
var scrollTop = $(window).scrollTop();
// if we scroll more than the navigation, change its position to fixed and add class 'fxd', otherwise change it back to absolute and remove the class
if (scrollTop > stickyTop) {
$('.smint').css({ 'position': 'fixed', 'top': 0 }).addClass('fxd');
} else {
$('.smint').css({ 'position': 'absolute', 'top': stickyTop }).removeClass('fxd');
}
};
// run function
stickyMenu();
// run function every time you scroll
$(window).scroll(function () {
stickyMenu();
});
后面还有 30 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。