aşağıdaki jQuery eklentisi sonucu uyaracaktır.
(function($) {
$.fn.isOverflowWidth = function() {
return this.each(function() {
var el = $(this);
if (el.css("overflow") == "hidden") {
var text = el.html();
var t = $(this.cloneNode(true)).hide().css('position', 'absolute').css('overflow', 'visible').width('auto').height(el.height());
el.after(t);
function width() {
return t.width() > el.width();
};
alert(width());
}
});
};
})(jQuery);
yüksekliğinde taşma belirlemek için
CSS
#tempDiv{
height:10px;
overflow:hidden;
}
genişliğinde taşma belirlemek için,
(function($) {
$.fn.isOverflowHeight = function() {
return this.each(function() {
var el = $(this);
if (el.css("overflow") == "hidden") {
var text = el.html();
var t = $(this.cloneNode(true)).hide().css('position', 'absolute').css('overflow', 'visible').height('auto').width(el.width());
el.after(t);
function height() {
return t.height() > el.height();
};
alert(height());
}
});
};
})(jQuery);
http://jsfiddle.net/C3hTV/
Tam olarak "algılamak" ile ne demek istiyorsunuz? Reaksiyonda ne yapmak istersin, bir kaydırma çubuğu mu gösterirsin? –
Eğer metin taşarsa fareyi vurgulu hale getirerek yeniden boyutlandırmak istiyorum ancak bu sorunun bir parçası olmadı. –
Büyük bir cevapla benzer eski soru: https://stackoverflow.com/a/143889/573057 – earcam