텍스트 리사이즈시 텍스트 노드도 리사이즈 되도록 스크립트 수정
This commit is contained in:
94
js/common.js
94
js/common.js
@ -525,31 +525,26 @@ var win_poll = function(href) {
|
|||||||
function text_increase()
|
function text_increase()
|
||||||
{
|
{
|
||||||
var $elements = $("#container *:visible");
|
var $elements = $("#container *:visible");
|
||||||
var fs = tx = unit = "";
|
var mode = "increase";
|
||||||
var fsize;
|
|
||||||
var x = 0;
|
|
||||||
$elements.each(function() {
|
$elements.each(function() {
|
||||||
if($(this).hasClass("no_text_resize"))
|
if($(this).hasClass("no_text_resize"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fs = $(this).css("font-size");
|
if($(this).children().length != 0) {
|
||||||
tx = $(this).html();
|
|
||||||
unit = fs.replace(/[0-9]/g, "");
|
|
||||||
fsize = parseFloat(fs.replace(/[^0-9\.]/g, ""));
|
|
||||||
|
|
||||||
if(!fsize)
|
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
var $parent = $(this).parent();
|
||||||
|
var text = $parent.contents().filter(function() {
|
||||||
|
return this.nodeType == 3;
|
||||||
|
}).text().replace(/\s*/, "");
|
||||||
|
|
||||||
if(tx.search("<") > -1)
|
if(text.length) {
|
||||||
return true;
|
font_resize($parent, mode);
|
||||||
|
} else {
|
||||||
if(unit == "em")
|
font_resize($(this), mode);
|
||||||
x = 1;
|
}
|
||||||
|
}
|
||||||
nfsize = (fsize * 1.2);
|
|
||||||
nfsize = nfsize.toFixed(x);
|
|
||||||
|
|
||||||
$(this).css("font-size", nfsize+unit);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,35 +554,58 @@ function text_increase()
|
|||||||
function text_decrease()
|
function text_decrease()
|
||||||
{
|
{
|
||||||
var $elements = $("#container *:visible");
|
var $elements = $("#container *:visible");
|
||||||
var fs = tx = unit = "";
|
var mode = "decrease";
|
||||||
var fsize;
|
|
||||||
var x = 0;
|
|
||||||
$elements.each(function() {
|
$elements.each(function() {
|
||||||
if($(this).hasClass("no_text_resize"))
|
if($(this).hasClass("no_text_resize"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fs = $(this).css("font-size");
|
if($(this).children().length != 0) {
|
||||||
tx = $(this).html();
|
|
||||||
unit = fs.replace(/[0-9]/g, "");
|
|
||||||
fsize = parseFloat(fs.replace(/[^0-9\.]/g, ""));
|
|
||||||
|
|
||||||
if(!fsize)
|
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
var $parent = $(this).parent();
|
||||||
|
var text = $parent.contents().filter(function() {
|
||||||
|
return this.nodeType == 3;
|
||||||
|
}).text().replace(/\s*/, "");
|
||||||
|
|
||||||
if(tx.search("<") > -1)
|
if(text.length) {
|
||||||
return true;
|
font_resize($parent, mode);
|
||||||
|
} else {
|
||||||
if(unit == "em")
|
font_resize($(this), mode);
|
||||||
x = 1;
|
}
|
||||||
|
}
|
||||||
nfsize = (fsize * 0.8);
|
|
||||||
nfsize = nfsize.toFixed(x);
|
|
||||||
|
|
||||||
$(this).css("font-size", nfsize+unit);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 텍스트 resize
|
||||||
|
**/
|
||||||
|
function font_resize(el, mode)
|
||||||
|
{
|
||||||
|
var x = 0;
|
||||||
|
var fs = el.css("font-size");
|
||||||
|
unit = fs.replace(/[0-9\.]/g, "");
|
||||||
|
fsize = parseFloat(fs.replace(/[^0-9\.]/g, ""));
|
||||||
|
|
||||||
|
if(!fsize)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(unit == "em")
|
||||||
|
x = 1;
|
||||||
|
|
||||||
|
if(mode == "increase") {
|
||||||
|
nfsize = (fsize * 1.2);
|
||||||
|
} else {
|
||||||
|
nfsize = (fsize / 1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
nfsize = nfsize.toFixed(x);
|
||||||
|
|
||||||
|
el.css("font-size", nfsize+unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
$('.win_point').click(function() {
|
$('.win_point').click(function() {
|
||||||
win_point(this.href);
|
win_point(this.href);
|
||||||
|
|||||||
Reference in New Issue
Block a user