我很新的命名空间和全局变量。我目前有这样的代码:命名空间全局变量问题
$('#formats1').hover(function() {
var tag = 'div.cds';
var offset = $(this).position();
var width = $(tag).outerWidth();
var height = $(tag).outerHeight();
$(tag).show();
$(tag).css('left', offset.left - width + 'px');
$(tag).css('top', offset.top - height + 'px');
}, function() {
$("div.cds").hide();
});
$('#formats2').hover(function() {
var tag = 'div.lp';
var offset = $(this).position();
var width = $(tag).outerWidth();
var height = $(tag).outerHeight();
$(tag).show();
$(tag).css('left', offset.left - width + 'px');
$(tag).css('top', offset.top - height + 'px');
}, function() {
$("div.lp").hide();
});
这是重复多次为此刻的各种申报单。
我觉得这将是合并命名空间&全局变量的好机会,但我不确定如何做到这一点。有任何想法吗?
谢谢!
完美!谢谢!谢谢@jAndy! – Yahreen 2011-05-23 21:05:26
@Yahreen没有problemo^_ ^ – Neal 2011-05-23 21:06:04