0
我不明白爲什麼如果我試圖返回CSS邊界屬性,它會返回一個空字符串,即使我已經設置了CSS的邊框。我也嘗試使用內聯方法設置邊框樣式,但仍然無法工作..任何想法?謝謝!jQuery插件 - 如果沒有選項填充,返回一個css屬性
(function($){
var methods = {
init : function(options, callbacks) {
if(options === undefined) {
return this.css("border");
}
return this.each(function(){
if(options === null) {
$(this).css("border","none");
return;
} else if(typeof options === "string") {
$(this).css("border", options);
return;
} else if(typeof options === "object") {
if(typeof options.style !== "undefined") {
$(this).css("border-style", options.style);
} else {
$(this).css("border-style", "solid");
}
if(typeof options.width !== "undefined") {
$(this).css("border-width", options.width);
}
if(typeof options.color !== "undefined") {
$(this).css("border-color", options.color);
}
if(typeof options.radius !== "undefined") {
$(this).css("border-radius", options.radius);
}
}
});
}
};
$.fn.border = function(method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else {
return methods.init.apply(this, arguments);
}
};
})(jQuery);
如果我試圖返回元素的顏色..一切似乎沒問題..但沒有與邊界屬性。
好像我在最新的谷歌瀏覽器的工作,雖然我在的jsfiddle作爲函數設置它,但它應該爲你工作不管。 [** FIDDLE **](http://jsfiddle.net/DJDavid98/BR95Y/)。 – SeinopSys
謝謝DJDavid ..我用另一種方法來解決這個問題..我會把它作爲這個問題的答案 –