mirror of
https://github.com/jimeh/jimeh.me-v3.0.git
synced 2026-02-19 05:46:40 +00:00
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
$(document).ready(function(){
|
|
|
|
$("a.fancybox").fancybox({
|
|
speedIn: 300,
|
|
speedOut: 250,
|
|
titlePosition: 'over',
|
|
transitionIn: 'elastic',
|
|
transitionOut: 'elastic',
|
|
// easingIn: 'easeOutBack',
|
|
// easingOut: 'easeInBack',
|
|
onComplete: function() {
|
|
$("#fancybox-wrap").hover(function(){
|
|
$("#fancybox-title").fadeIn();
|
|
}, function() {
|
|
$("#fancybox-title").fadeOut();
|
|
});
|
|
}
|
|
}).hover(function(){
|
|
var self = $(this);
|
|
if (self.children("img").length > 0 && !self.hasClass("no-title")) {
|
|
if (self.children("i").length == 0) {
|
|
var alt = self.attr("title");
|
|
if (alt === "") alt = self.children("img").attr("alt");
|
|
var limit = self.width() / 6;
|
|
if (alt !== '') {
|
|
if (alt.length > limit) {
|
|
alt = $.trim(alt.substr(0, limit)) + "...";
|
|
};
|
|
self.append("<i>" + alt + "</i>");
|
|
};
|
|
};
|
|
self.children("i").fadeIn();
|
|
};
|
|
},function(){
|
|
var self = $(this);
|
|
if (self.children("img").length > 0 && !self.hasClass("no-title")) {
|
|
self.children("i").fadeOut();
|
|
};
|
|
});
|
|
|
|
}); |