/**
* Multi Directional link jQuery plugin
* @name mullinx.js
* @version 0.1
* @author Carlo Zapponi - info@makinguse.com
* @site http://mullinx.makinguse.com
* @date October 2, 2008
* @category jQuery plugin
* @license CC Attribution-Share Alike 2.5 Italy - http://creativecommons.org/licenses/by-sa/2.5/it/
* @example Visit http://mullinx.makinguse.com for more informations about this jQuery plugin
* @requires jQuery 1.2+
*/
(function($) {
var jq=jQuery;
jq.fn.mullinx = function(options) {
var options = jq.extend({},jq.fn.mullinx.defaults,options);
var tm=new Date().getTime();
return this.each(function(index,el) {
var $this=jQuery(this);
$this.over=false;
var pos=$this.offset();
var dim={
w:$this.width(),
h:$this.height()
};
var mudim={};
var addresses=$this.attr("rev").split(options.separator);
if(addresses.length>0 && addresses[0]!="") {
var mux=jq("
").attr("id","mux_"+index+"_"+tm).css({
position:"absolute",
top:pos.top+dim.h+"px",
backgroundColor:"transparent",
display:"none",
fontFamily:options.fontFamily,
letterSpacing:"-0.025em",
fontWeight:"bold",
//textShadow:"#555 1px 1px 2px", //works in safari
fontSize:options.fontSize
}).bind("mouseleave",function(e){
mux.hide();
});
var links=""+$this.html()+"";
jq.each(addresses,function(){
var $link=this.split(options.sub_separator);
links+=""+jq.trim(($link[1]?$link[1]:$link[0]))+"";
});
links="";
jq(mux).roundbox({
id:"mux_"+index+"_"+tm+"_rc",
content:links,
bgcolor:options.bgcolor,
opacity:options.opacity
});
//mux.appendTo($this.parent());
mux.appendTo(jq(document.body));
mux.find("li a").hover(function() {
jq(this).css({
"text-decoration":"underline",
color:options.hoverColor
});
},
function() {
jq(this).css({
"text-decoration":"none",
color:options.color
});
}).click(function(e){
mux.hide();
});
jq("").html("^").css({
position:"absolute",
color:options.bgcolor,
left:"-5px",
fontSize:"86px",
lineHeight:"56px",
fontFamily:"Times New Roman",
fontWeight:"bold",
height:"8px",
overflow:"hidden",
top:"-8px",
opacity:options.opacity
}).appendTo("#"+mux.attr("id")+"_rc");
$this.bind("mouseenter",function(e){
pos=$this.offset();
mux.show();
mudim=(mudim.w)?mudim:{w:mux.children("div").eq(0).width(),h:mux.children("div").eq(0).height()}
var delta=jq(window).width()-(pos.left+mudim.w);
mux.css({
left:pos.left+(delta<0?(delta-5):0)+"px",
width:mudim.w+"px"
}).children("div").eq(0).css({
top:"8px"
}).children("span").eq(0).css({
left:(delta<0?(-delta):0)+"px"
});
}).bind("mouseleave",function(e){
if(!(e.pageY>=pos.top+dim.h))
mux.hide();
});
jq(window).resize(function(e){
pos=$this.offset();
mux.css({
top:pos.top+dim.h+"px"
});
});
}
});
};
jQuery.fn.roundbox=function() {
// this is a jquery plugin with my personal rounded corners implementation,
// the same I've used in PodiPodi.com
var options = jQuery.extend({
bgcolor:"#000",
color:"#fff",
opacity:0.8
}, arguments[0] || {});
var html="• • • •"+
""+options.content+"
";
var rc=jQuery(""+html+"
").attr("id",options.id).css("position","absolute").appendTo(this).children(".ctl,.ctr,.cbl,.cbr").css({
width:"6px",
height:"6px",
color:options.bgcolor,
background:"transparent",
overflow:"hidden",
fontStyle:"normal",
zIndex:1
}).end().find("em").css({
position:"absolute",
zIndex:1001,
color:options.bgcolor,
opacity:options.opacity
}).end().find(".ct,.cr,.cb,.cl,.c_box").css("background",options.bgcolor).end().find(".ct").css({
top:"0",
height:"6px",
left:"6px",
right:"6px"
}).end().find(".cl").css({
top:"6px",
width:"6px",
left:"0",
bottom:"6px"
}).end().find(".c_box").css({
top:"6px",
bottom:"6px",
left:"6px",
right:"6px"
}).end().find(".cr").css({
top:"6px",
bottom:"6px",
width:"6px",
right:"0"
}).end().find(".cb").css({
height:"6px",
bottom:"0",
left:"6px",
right:"6px"
}).end().find(".ctl").css({
top:"0",
left:"0",
height:"6px"
}).end().find(".cbl").css({
bottom:"0",
left:"0"
}).end().find(".ctr").css({
top:"0",
right:"0",
height:"6px"
}).end().find(".cbr").css({
bottom:"0",
right:"0"
}).end().find("em b").css({
position:"absolute",
fontSize:"60px",
fontFamily:"arial",
lineHeight:"16px",
fontWeight:"normal",
color:options.bgcolor
}).end().find(".ctl b").css({
left:"-3px",
top:"0px"
}).end().find(".ctr b").css({
left:"-12px",
top:"0"
}).end().find(".cbl b").css({
left:"-3px",
top:"-9px",
bottom:"0"
}).end().find(".cbr b").css({
left:"-12px",
top:"-9px",
bottom:"0"
}).end();
// workaround for IE6 in order to see the background
// same technique used on PodiPodi.com
if (jQuery.browser.msie && jQuery.browser.version<7) {
rc.css("background-color",options.bgcolor);
}
return this;
};
// mullinx default options
jq.fn.mullinx.defaults = {
separator:";",
sub_separator:"|",
bgcolor:"#000",
color:"#fff",
hoverColor:"#ffff00",
opacity:0.9,
fontSize:"0.8em",
fontFamily:"Arial"
};
})(jQuery);