#204 에 따른 텍스트 크기 조절 기능 추가

This commit is contained in:
chicpro
2013-03-05 14:18:38 +09:00
parent f817c1939f
commit e1a2f8eb59
2 changed files with 82 additions and 2 deletions

View File

@ -161,6 +161,6 @@ if ($config['cf_include_head']) {
<div id="container">
<? if ((!$bo_table || $w == 's' ) && !defined("_INDEX_")) {?><h1 id="wrapper_title"><?=$g4['title']?></h1><?}?>
<div id="text_size">
<button>크게</button>
<button>작게</button>
<button id="text_increase" class="no_text_resize">크게</button>
<button id="text_decrease" class="no_text_resize">작게</button>
</div>

View File

@ -519,6 +519,75 @@ var win_poll = function(href) {
new_win.focus();
}
/**
* 텍스트 크게
**/
function text_increase()
{
var $elements = $("#container *:visible");
var fs = tx = unit = "";
var fsize;
var x = 0;
$elements.each(function() {
if($(this).hasClass("no_text_resize"))
return true;
fs = $(this).css("font-size");
tx = $(this).html();
unit = fs.replace(/[0-9]/g, "");
fsize = parseFloat(fs.replace(/[^0-9\.]/g, ""));
if(!fsize)
return true;
if(tx.search("<") > -1)
return true;
if(unit == "em")
x = 1;
nfsize = (fsize * 1.2);
nfsize = nfsize.toFixed(x);
$(this).css("font-size", nfsize+unit);
});
}
/**
* 텍스트 작게
**/
function text_decrease()
{
var $elements = $("#container *:visible");
var fs = tx = unit = "";
var fsize;
var x = 0;
$elements.each(function() {
if($(this).hasClass("no_text_resize"))
return true;
fs = $(this).css("font-size");
tx = $(this).html();
unit = fs.replace(/[0-9]/g, "");
fsize = parseFloat(fs.replace(/[^0-9\.]/g, ""));
if(!fsize)
return true;
if(tx.search("<") > -1)
return true;
if(unit == "em")
x = 1;
nfsize = (fsize * 0.8);
nfsize = nfsize.toFixed(x);
$(this).css("font-size", nfsize+unit);
});
}
$(function(){
$('.win_point').click(function() {
win_point(this.href);
@ -608,4 +677,15 @@ $(function(){
$('.sv').removeClass('sv_on');
}
});
// 텍스트 리사이즈
$("#text_increase").click(function() {
text_increase();
return false;
});
$("#text_decrease").click(function() {
text_decrease();
return false;
});
});