TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 25, 2024, 10:07:35 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,173
  • Total Topics: 21,219
  • Online today: 319
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 218
  • Total: 219
  • tino

A+ | A - | RESET

Started by os1, March 22, 2006, 02:10:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

os1

hi guys...
just wondering if the text size adjuster (top right of Bz7) is going to be available in mod form??

This is a great feature and would make many forums in the UK DDA compliant.

Great work totally love TP/smf wont go to anything else!!

ontap


im not so sure it will be a mod, think bloc was messing about with some code?...

Xarcell

I don't think it was a mod, it is just a theme feature. I could be wrong though...

TwinsX2Dad

It appears to be a very simple theme feature - one we'd implemented years ago on various UBB boards. It is javascript, which should make it easy to customize.

Place this code in the <head> of your template:

<script type="text/javascript">
var tags = new Array( 'div','td','tr','p','b','table','strong','emphasis','a','h1','h2','h3','pre','sub','sup','i','th','cp','ul','ol','li','dt','dd');
var pixelArray =  new Array('10','12','16','20','24','30','40');
var emArray =  new Array('0.7','0.9','1.0','1.5','2.0','2.5','3');
var initSize = 1;

function fontSizer(inc,unit) {
     if (!document.getElementById)
          return;
     var size = initSize;
          size += inc;
     if (size < 0 ) {
          size = 0;
}
     if (size > 6 ) {
          size = 6;
}
          initSize = size;
          getBody = document.getElementsByTagName('body')[0];
     for (i = 0 ; i < tags.length ; i++ ) {
          getallTags = getBody.getElementsByTagName(tags[i]);
     for (k = 0 ; k < getallTags.length ; k++)
          getallTags[k].style.fontSize = (unit=='px') ? pixelArray[size]+unit: emArray[size]+unit;
     }
}

</script>



Then, wherever you want to have the links for changing the font size, place these hyperlinks in your template:

<a href="#" onMouseDown="fontSizer(1,'px')">Increase Font Size</a>

<a href="#"  onMouseDown="fontSizer(-1,'px')">Decrease Font Size</a>


You can remove any tags you don't want resized from the array (between the head tags):

var tags = new Array( 'div','td','tr','p','b','table','strong','emphasis','a','h1','h2','h3','pre','sub','sup','i','th','cp','ul','ol','li','dt','dd');


This can be added to an existing theme or built into a new one.


bloc

Quite true ..its a javascript for changing the sizes dynamically. But it also have a "remember" feature that javascript can't do alone. :) Its great to change it, but really no use if you need to change it on every page.

If you notice though, its not flawless..it changes all items to one size lesser or bigger..but when you refresh the internal relAtions bewteeen items show up again. Not abig deal..but just a thing to remember, use percentages for fontsizes.

I can post the code to be used in the theme if you want..its nothing mysterious about it really. :)

eldacar

Would be nice to see this added through JS and used with an eventlistener ;) But there are a lot of things it would be nice to see hehe

TwinsX2Dad

Quote from: Bloc on March 22, 2006, 11:09:34 AMBut it also have a "remember" feature that javascript can't do alone. :)

I knew I was missing something.   ;)

erikman

Thanks, but my design doesn`t support it...

(using on normal php-page)

os1

QuoteI can post the code to be used in the theme if you want

That would be great bloc.

PZsHosting