Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 03:01:00 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Font resizer?  (Read 1042 times)
Boudi
Addon Team

Offline Offline

Posts: 816



WWW
« on: April 22, 2008, 09:18:03 AM »

Hi,

After checking the forum I could not find any snippets around this addon so I post it here.

May be it's an idea to create an addon in which visitors can resize the font in a WB website.

You see this more often for visitors who have less eyesight. Then they can click on a button in which increases (or decreases) the font size of the text.

Sincerely,
Knert
Logged

...:: Bake the Unbakable ::...
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #1 on: April 22, 2008, 11:14:37 AM »

Hello,

there exist a lot of scripts (javascript) and css howtos in the world wide web how to make this. I would preferr a css solution, as this can be used from users who have javascript deactivated too. Basically you only switch between different css in your template. There is no need for a wb-modul for this.

Matthias
Logged
Boudi
Addon Team

Offline Offline

Posts: 816



WWW
« Reply #2 on: April 22, 2008, 02:24:23 PM »

Hello Matthias,

Thnq for your quick answer.

I already had that option as a back-up in my mind but may be there was some (unsupported) addon who already answered my question.  cheesy

Sinverely,
Knert

 
Logged

...:: Bake the Unbakable ::...
marathoner

Offline Offline

Posts: 495


« Reply #3 on: April 22, 2008, 05:12:16 PM »

@knert-
Just do a search of this forum for a template switcher that using session variable to be persistent. This allows you to have several templates that differ only in the CSS font size. No JS needed.
Logged
mbrasil

Offline Offline

Posts: 1


« Reply #4 on: October 12, 2009, 08:14:23 PM »

i use this code:

<head> (...)

<script>
var tam = 20;

function mudaFonte(tipo,elemento){
if (tipo=="mais") {
if(tam<36) tam+=1;
createCookie('fonte',tam,365);
} else {
if( tam>8 ) tam-=1;
createCookie('fonte',tam,365);
}
document.getElement ById('content').style.fontSize = tam+'px';
}

function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
} else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.spl it(';');
for(var i=0;i < ca.length;i++)
{
var c = ca;
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

</script>

(...)
</head>

in body:
(...)

<div id="text">
        Fonte size:
        <span onclick="mudaFonte('menos','div')" style="cursor: pointer;">[ - ]</span> |
        <span onclick="mudaFonte('mais','div')" style="cursor: pointer;">[ + ]</span>
</div>
   
<div class="content" id="content">
   <h1><?php page_title('', '[PAGE_TITLE]'); ?></h1>
    <?php page_content(); ?>
</div>

(...)
« Last Edit: October 12, 2009, 08:18:56 PM by mbrasil » Logged
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #5 on: October 20, 2009, 12:49:08 PM »

Lots of options to so this. I'll add another one using jQuery.

Download fontsizer.jquery.js from http://www.fluidbyte.net/index.php?view=JQuery-Font-Sizer and save it in your template dir.

Put this in the HEAD of your template:
Code:
<script type="text/JavaScript" src="<?php echo WB_URL?>/include/jquery/jquery-min.js"></script>
<script type="text/JavaScript" src="<?php echo TEMPLATE_DIR?>/fontsizer.jquery.js"> </script>
and
Code:
<script language="javascript">
  $(document).ready(function() {
  fontResizer('85%','100%','110%');
  });
</script>
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!