我一直在嘗試使用jQuery.fn.extend()
,它一直在工作,但我想獲得調用它的ID,類或html標記。我無法知道調用我的fn
的字符串是標記,ID還是類。 。如何獲取調用我的函數的元素的ID,類或HTML標記?
例如,
$( '表')scrollify();
我希望能夠得到字符串'table'
不this
我scrollify
函數內部
這裏是我的代碼:
(function($) {
$.fn.scrollify = function() {
$('tbody').css({
'width': Math.ceil($('thead').width() + 17)
});
$('tbody > tr > td').css({
'width': Math.ceil($('thead').width())
});
$('thead > tr > th').css({
'width': $('tbody').width()/$('thead > tr > th').length
});
$('tbody').css({
'margin-top': $('thead').height() - 1
});
return this.get(0).scrollHeight > this.height();
};
})(jQuery);
$('table').scrollify();
這就是整個問題,我不知道要做什麼,無論是身份證,標籤還是班級 – Kyle