web/assets/libs/jquery-plugin/jquery.lavaTab/jquery.lavaTab.js
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/**
* tab火焰灯效果切换插件
* @author zhangshaoliu
* @date 2015-8-14
*/
define(function(require, exports, module){
require('jquery.easing');
/**
* 私有方法,检测参数是否合法
* @param {Object} options 配置参数对象
* @return {Boolean}
*/
function isObject(options) {
return !options || (options && Object.prototype.toString.call(options) === "[object Object]") ? true : false;
}
var defaults = {
fx: "linear",
speed: 500,
click: function() {}
};
$.fn.lavaTab = function(opts) {
if (!isObject(opts)) {
return this;
}
var settings = $.extend({}, defaults, opts);
return this.each(function() {
var $wrapEl = $(this),
noop = function() {},
$moveEl = $('<li class="highlight"></li>').appendTo($wrapEl),
$tabItem = $("li", this),
selectedItem = $("li", this)[0];
function setCurrent(tabItem) {
$moveEl.css({
"left": tabItem.offsetLeft + "px",
"width": tabItem.offsetWidth + "px"
});
$(tabItem).addClass('active').siblings().removeClass('active');
selectedItem = tabItem;
};
function moveLight(tabItem) {
$moveEl.each(function() {
$(this).dequeue();
}).animate({
width: tabItem.offsetWidth,
left: tabItem.offsetLeft
}, settings.speed, settings.fx);
}
$(this).hover(noop, function() {
moveLight(selectedItem);
});
$tabItem.not(".highlight").hover(function() {
moveLight(this);
}, noop);
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。