Hallo zusammen, lese hier schon lange und sehr gerne mit aber heute stelle ich zum ersten Mal eine Frage:
Ich habe zwei JS-Dateien, die mein Menü unsichtbar machen. Bei beiden würde ich gerne diesen Effekt ausstellen, kenne mich jedoch leider mit JS überhaupt nicht aus. Ist jemand von euch so lieb mir ein bisschen zu helfen?
Das wäre ganz ganz lieb!
Liebe Grüße Lina
/*
* Superfish v1.4.8 - jQuery menu widget
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
*/
;(function($){
$.fn.superfish = function(op){
var sf = $.fn.superfish,
c = sf.c,
$arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')),
over = function(){
var $$ = $(this), menu = getMenu($$);
clearTimeout(menu.sfTimer);
$$.showSuperfishUl().siblings().hideSuperfishUl();
},
out = function(){
var $$ = $(this), menu = getMenu($$), o = sf.op;
clearTimeout(menu.sfTimer);
menu.sfTimer=setTimeout(function(){
o.retainPath=($.inArray($$[0],o.$path)>-1);
$$.hideSuperfishUl();
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
},o.delay);
},
getMenu = function($menu){
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
sf.op = sf.o[menu.serial];
return menu;
},
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
return this.each(function() {
var s = this.serial = sf.o.length;
var o = $.extend({},sf.defaults,op);
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
.filter('li:has(ul)').removeClass(o.pathClass);
});
sf.o[s] = sf.op = o;
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
if (o.autoArrows) addArrow( $('>a:first-child',this) );
})
.not('.'+c.bcClass)
.hideSuperfishUl();
var $a = $('a',this);
$a.each(function(i){
var $li = $a.eq(i).parents('li');
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
});
o.onInit.call(this);
}).each(function() {
var menuClasses = [c.menuClass];
if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
$(this).addClass(menuClasses.join(' '));
});
};
var sf = $.fn.superfish;
sf.o = [];
sf.op = {};
sf.IE7fix = function(){
var o = sf.op;
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
this.toggleClass(sf.c.shadowClass+'-off');
};
sf.c = {
bcClass : 'sf-breadcrumb',
menuClass : 'sf-js-enabled',
anchorClass : 'sf-with-ul',
arrowClass : 'sf-sub-indicator',
shadowClass : 'sf-shadow'
};
sf.defaults = {
hoverClass : 'sfHover',
pathClass : 'overideThisToUse',
pathLevels : 1,
delay : 800,
animation : {opacity:'show'},
speed : 'normal',
autoArrows : true,
dropShadows : true,
disableHI : false, // true disables hoverIntent detection
onInit : function(){}, // callback functions
onBeforeShow: function(){},
onShow : function(){},
onHide : function(){}
};
$.fn.extend({
hideSuperfishUl : function(){
var o = sf.op,
not = (o.retainPath===true) ? o.$path : '';
o.retainPath = false;
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
.find('>ul').slideUp()//.parent().find('span').stop().animate({opacity:0});
var selectLi = $ul.parent();
if(!$.browser.msie){
selectLi.not('.active').find('>span').stop().animate({scale:0, opacity:0}, 500,"easeOutBack");
selectLi.not('.active').find('>a').stop().animate({color:"#000"},300);
}else{
selectLi.not('.active').find('> span').css({"visibility":"hidden"});
selectLi.not('.active').find('> a').css({color:"#000"})
}
o.onHide.call($ul);
return this;
},
showSuperfishUl : function(){
var o = sf.op,
sh = sf.c.shadowClass+'-off',
$ul = this.addClass(o.hoverClass)
.find('>ul:hidden').css('visibility','visible');
sf.IE7fix.call($ul);
o.onBeforeShow.call($ul);
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
return this;
}
});
})(jQuery);
und der Zweite
/*0.2*/
;(function($){
$.fn.navs=function(opt){
if(opt===undefined)
opt={}
this.each(function(){
var th=$(this),
data=th.data('navs'),
_={
enable:true,
activeCl:'active',
event:'click',
backLink:'a[data-type=back]',
closeLink:'a[data-type=close]',
blockSame:true,
useHash:false,
contRetFalse:false,
hover:true,
preFu:function(){
_.n=-1
_.curr=false
_.li.each(function(i){
var th=$(this)
th.data({num:i})
if(th.hasClass(_.activeCl))
_.n=i,
_.curr=th,
_.hoverIn(th)
})
},
refreshFu:function(){
if(!_.enable)
return false
_.li.each(function(i){
var th=$(this),
tmp
if(th.hasClass(_.activeCl))
_.curr=th,
_.n=th.data('num')
})
if(_.curr)
_.hoverIn(_.curr)
_.li.not(_.curr).each(function(){
var th=$(this)
_.hoverOut(th)
})
},
changeFu:function(n,param){
param=param||n
if(!_.enable)
return false
if(n==_.n&&_.blockSame)
return false
_.prev=_.n
_.li.removeClass(_.activeCl)
_.li.each(function(i){
var th=$(this)
if(typeof n=='number')
if(n==i)
th.addClass(_.activeCl),
_.n=i
if(typeof n=='string')
if(n==th.attr('href'))
th.addClass(_.activeCl),
_.n=i
})
_.refreshFu()
_.onChangeFu(param)
},
onChangeMas:[],
onChangeFu:function(param){
$(_.onChangeMas).each(function(){
if(typeof this=='function')
this.call(_.me,param,_)
})
},
nextFu:function(){
var n=_.n
_.changeFu(++n<_.li.length?n:0)
},
prevFu:function(){
var n=_.n
_.changeFu(--n>=0?n:_.li.length-1)
},
controlsFu:function(){
_.li.each(function(i){
var li=$(this)
$('>a',li)
.bind(_.event,function(){
_.changeFu(i)
if(_.contRetFalse)
return false
})
})
},
navFu:function(){
$(_.backLink)
.live(_.event,function(){
if(!_.enable)
return false
_.backFu()
return false
})
$(_.closeLink)
.live(_.event,function(){
if(!_.enable)
return false
_.closeFu()
})
},
backFu:function(){
location.hash=_.prevHash
},
closeFu:function(){
var n=_.n
_.prev=n
_.n=-1
_.curr=false
_.li.removeClass(_.activeCl)
_.li.each(function(){_.hoverOut($(this))})
_.onChangeFu('close')
},
hoverFu:function(){
_.li.each(function(i){
$('>a',this)
.bind('mouseenter',function(){
if(_.enable)
if(_.hover&&!_.li.eq(i).hasClass(_.activeCl))
_.hoverIn(_.li.eq(i))
})
.bind('mouseleave',function(){
if(_.enable)
if(_.hover&&!_.li.eq(i).hasClass(_.activeCl))
_.hoverOut(_.li.eq(i))
})
})
},
hashFu:function(){
$(window)
.bind('hashchange',function(){
if(!_.enable)
return false
_.prevHash=_.hash
_.hash=location.hash
if(location.hash.slice(0,2)=='#!')
_.hashChFu()
})
},
hashChFu:function(){
var ch=false
_.li.each(function(i){
var tmp=$('>a',this).attr('href')
if(tmp==location.hash)
_.changeFu(i,location.hash),
ch=true
})
if(!ch)
_.prev=_.n,
_.n=-1,
_.curr=false,
_.li.removeClass(_.activeCl),
_.li.each(function(){_.hoverOut($(this))}),
_.onChangeFu(location.hash)
},
init:function(){
_.me=this
_.ul=$('>ul',_.me)
_.li=$('>li',_.ul)
_.preFu()
if(_.useHash)
_.hashFu()
else
_.controlsFu()
_.navFu()
_.hoverFu()
_.hoverOut(_.li)
_.refreshFu()
if(location.hash.slice(0,2)=='#!'){
var hash=location.hash
location.hash=''
location.hash=hash
}
},
hoverIn:function(){},
hoverOut:function(){}
}
if(!data)
(typeof opt=='object'?$.extend(_,opt):_).init.call(th),
th.data({navs:_}),
data=_
else
_=typeof opt=='object'?$.extend(data,opt):data
if(typeof opt=='number')
_.changeFu(opt)
if(typeof opt=='string')
if(opt=='prev'||opt=='next'||opt=='close'||opt=='back')
_[opt+'Fu']()
else
if(opt.slice(0,2)=='#!')
location.hash=opt
if(typeof opt=='function')
_.onChangeMas.push(opt)
if(typeof opt=='boolean')
_.enable=opt
})
return this
}
$.fn.cont_sw=function(opt){
if(opt===undefined)
opt={}
this.each(function(){
var th=$(this),
data=th.data('cont_sw'),
_={
enable:true,
blockSame:true,
duration:800,
easing:'linear',
preFu:function(){
_.li.hide()
},
showFu:function(){
_.next
.css({opacity:0})
.show()
.stop()
.animate({
opacity:1
},{
duration:_.duration,
easing:_.easing
})
},
hideFu:function(){
_.li.hide()
},
nextFu:function(){
var n=_.n
_.changeFu(++n<_.li.length?n:0)
},
prevFu:function(){
var n=_.n
_.changeFu(--n>=0?n:_.li.length-1)
},
navFu:function(str){
if(_.prevStr==str)
return false
_.prevStr=str
_.li.each(function(i){
var th=$(this)
if(th.attr('id')==str.slice(3))
_.next=th,
_.prev=_.n,
_.n=i,
_.hideFu(),
_.showFu()
})
},
closeFu:function(){
if(_.prevStr=='close')
return false
_.n=-1
_.prevStr='close'
_.hideFu()
},
backFu:function(){
_.changeFu(_.prev)
},
changeFu:function(n){
if(!_.enable)
return false
if(n==_.n&&_.blockSame)
return false
var fu=function(){
_.prev=_.n
_.n=n
_.next=_.li.eq(n)
_.hideFu(_)
_.showFu(_)
_.onChangeFu(n)
}
$.when(_.li).then(fu)
},
onChangeMas:[],
onChangeFu:function(param){
$(_.onChangeMas).each(function(){
if(typeof this=='function')
this.call(_.me,param,_)
})
},
init:function(){
_.me=this
_.ul=$('>ul',_.me)
_.li=$('>li',_.ul)
_.preFu()
}
}
if(!data)
(typeof opt=='object'?$.extend(_,opt):_).init.call(th),
th.data({cont_sw:_}),
data=_
else
_=typeof opt=='object'?$.extend(data,opt):data
if(typeof opt=='number')
_.changeFu(opt)
if(typeof opt=='string')
if(opt=='prev'||opt=='next'||opt=='close'||opt=='back')
_[opt+'Fu']()
else
if(opt.slice(0,2)=='#!')
_.navFu(opt)
if(typeof opt=='function')
_.onChangeMas.push(opt)
if(typeof opt=='boolean')
_.enable=opt
})
return this
}
})(jQuery)