我编写了调用 jQuery.noConflict(); 的代码。很多次。如何减少 jQuery.noConflict(); 存在,因为我认为该声明重复多次并不好
$glob = jQuery.noConflict();
/* functions to run when content loads */
$glob(document).ready(function(){
var ht = $glob(window).height();
$glob('.content').css({
'height': ht,
'min-height': ht
});
$glob('#page').css({
'top':-ht
});
});
/* functions to run when page loads */
function animateHorizontal2id(id,msg){ //the id to animate, the easing type
var $a = jQuery.noConflict(); // defined to remove jquery conflict error
var animSpeed=2000; //set animation speed
var page= $a("#page"); //define the page to move
var ht = $a(window).height();
//do the animation
var archPos = $a(id).position().left;
$a('#architecture').css({
'left': archPos
});
page.stop().animate({"left": -($a(id).position().left)}, animSpeed
);
$a('#page').css({
'top': -ht
});
//}
}
function animateVertical2id(id,msg) {
var $arct = jQuery.noConflict(); // defined to remove jquery conflict error
var animSpeed=2000; //set animation speed
var page= $arct("#page"); //define the page to move
//do the animation
page.stop().animate({"top": -($arct(id).position().top)}, animSpeed);
}
function animate2Home(id,msg) {
var $home = jQuery.noConflict(); // defined to remove jquery conflict error
var archPos = $home(id).position().left;
var ht = $home(window).height();
$home('#page').css({
'top': -ht
});
$home('#architecture').css({
'left': archPos
});
var animSpeed=2000; //set animation speed
var page= $home("#page"); //define the page to move
//do the animation
page.stop().animate({"left": -($home(id).position().left)}, animSpeed);
}