/*! Copyright 2011, Marian Posaceanu
* Licensed under the MIT License (LICENSE.txt).
* VertiLinks
* Version: 1.0.0
*
* Requires: jQuery 1.2.6+
*/
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
return this;
};
var VertiLinks = function(data) {
if( data.length > 0 ) {
this.construct_ui();
data.each(function(){
$(this).click(function(){
$("#vertilinks").html("");
this.img_link = $(this).attr("href");
this.img_title = $(this).html();
$('
', {
html: this.img_title
}).css({
'cursor': 'pointer',
'float' : 'left',
'height' : 'auto',
'width' : '430px',
'padding' : '2px 5px',
'color' : '#FFF',
'font-size' : '14px',
'background-color' : 'red'
}).appendTo("#vertilinks");
$('
', {
src: this.img_link
}).css({
'cursor': 'pointer',
'float' : 'left'
}).appendTo("#vertilinks");
$("#vertilinks").fadeIn();
$("#vertilinks").center();
return false;
});
});
}
};
VertiLinks.prototype = {
construct_ui: function() {
this.base = $('
', {
id: 'vertilinks',
click: function() {
$(this).hide();
}
}).css({
position: 'absolute',
display: 'none',
width: '440px',
height: 'auto'
}).appendTo("body");
}
};