Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ravi Teja
How to Increase and Decrease the Textsize in Portal pages
March 13, 2013 4:08 AM
Answer

Ravi Teja

Rank: New Member

Posts: 21

Join Date: July 9, 2012

Recent Posts

Hi,

I want to Increase and Decrease the Text size(Font) of a Portal pages.
My Requirement is like this Please check this URL https://www.bcs.org/
is it possible to do with life ray?

Could someone Please help me out.
gordon daniels
RE: How to Increase and Decrease the Textsize in Portal pages
March 13, 2013 11:51 AM
Answer

gordon daniels

Rank: Liferay Master

Posts: 650

Join Date: August 23, 2008

Recent Posts

Ravi: there are several ways you can do that. You can create a theme and include how you want fonts and layout to be. You can use the Web Content Portlet and add different size fonts, banners, images and other widgets.

But there is a learning curve :-)
Ravi Teja
RE: How to Increase and Decrease the Textsize in Portal pages
March 17, 2013 10:44 PM
Answer

Ravi Teja

Rank: New Member

Posts: 21

Join Date: July 9, 2012

Recent Posts

Hey Daniel,

Thanks for such quick reply ..

I am Implementing the same thing.

Here i used Jquery Plugin to Increase & Decrease the Font Size.
I am integratiating the the required Script in Theam. It is working For only <body> Tag (the content which is placed in inside <body> tag).
if i did't take <body> tag (OR) if i Declare the other Html Tags i.e outside the <body> Tag. The Font Size functionality is won't Effected for Other HtmlTags.
In this case I need to Write Jquery Code For All HTML Tags ?

(OR)

Any Other Solution is there to Overcome this?

Here i am Attaching my code. can u plz take a look at this.

main.js File
 1
 2
 3addDOMLoadEvent=(function(){var e=[],t,s,n,i,o,d=document,w=window,r='readyState',c='onreadystatechange',x=function(){n=1;clearInterval(t);while(i=e.shift())i();if(s)s[c]=''};return function(f){if(n)return f();if(!e[0]){d.addEventListener&&d.addEventListener("DOMContentLoaded",x,false);/*@cc_on@*//*@if(@_win32)d.write("<script id=__ie_onload defer src=//0><\/scr"+"ipt>");s=d.getElementById("__ie_onload");s[c]=function(){s[r]=="complete"&&x()};/*@end@*/if(/WebKit/i.test(navigator.userAgent))t=setInterval(function(){/loaded|complete/.test(d[r])&&x()},10);o=w.onload;w.onload=function(){x();o&&o()}}e.push(f)}})();
 4var fS={
 5  iFS:null,
 6  cFS:null,
 7  init: function (fC) {
 8    if (!document.getElementById || !document.createTextNode) { return; }
 9    if (UBCookie.read("fS")) {
10      var sizes = UBCookie.read("fS").split(",");
11      fS.iFS = sizes[0]*1;
12      fS.cFS = sizes[1]*1;
13      fS.setBodySize();
14    } else {
15      var el = document.createElement('span');
16      el.innerHTML = "&nbsp;";
17      el.style.position = "absolute";
18      el.style.left = "-9999px";
19      el.style.lineHeight = "1em";
20      document.body.insertBefore(el,document.body.firstChild);
21      fS.iFS = el.offsetHeight/16;
22      fS.cFS = fS.iFS;
23      UBCookie.create("fS",fS.iFS+","+fS.cFS,30);
24    }
25    fS.addJSLink(fC,fS.incFS,"A+","increaseSize");
26    fS.addJSLink(fC,fS.rFS,"R","resetSize");
27    fS.addJSLink(fC,fS.decFS,"A-","decreaseSize");
28  },
29  incFS: function () {
30    fS.cFS = fS.cFS*1.25;
31    fS.setBodySize();
32    return false;
33  },
34  decFS: function () {
35    fS.cFS = fS.cFS*0.8;
36    fS.setBodySize();
37    return false;
38  },
39  rFS: function () {
40    fS.cFS = fS.iFS;
41    fS.setBodySize();
42    return false;
43  },
44  setBodySize: function() {
45        document.body.style.fontSize = fS.cFS + 'em';
46    UBCookie.create("fS",fS.iFS+","+fS.cFS,30);
47  },
48  addJSLink: function (elementId, onClickFunction, linkText, className) {
49    var element = document.getElementById(elementId);
50    var link = document.createElement("a");
51    link.className = className;
52    var linkText = document.createTextNode(linkText);
53    link.appendChild(linkText);
54    link.onclick = onClickFunction;
55    link.href="#"+elementId;
56    element.appendChild(link);
57  }
58}
59
60var UBCookie={
61  create: function (name,value,days) {
62    if (days) {
63      var date = new Date();
64      date.setTime(date.getTime()+(days*24*60*60*1000));
65      var expires = "; expires="+date.toGMTString();
66    } else { var expires = ""; }
67    document.cookie = name+"="+value+expires+"; path=/";
68  },
69  read: function (name) {
70    var nameEQ = name + "=";
71    var ca = document.cookie.split(';');
72    for(var i=0;i < ca.length;i++) {
73      var c = ca[i];
74      while (c.charAt(0)==' ') c = c.substring(1,c.length);
75      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
76    }
77    return null;
78  },
79  erase: function(name) { createCookie(name,"",-1); }
80}
81
82addDOMLoadEvent(function() {fS.init("fontControls")});


And in Theam i included this

<style type="text/css">
body { font-size:62.5%; }

#fontControls a{margin:0 10px; border:1px solid #ccc; padding:3px; backgroundemoticonf3f3f3 }
</style>

<div id="fontControls"></div>
gordon daniels
RE: How to Increase and Decrease the Textsize in Portal pages
March 16, 2013 9:20 PM
Answer

gordon daniels

Rank: Liferay Master

Posts: 650

Join Date: August 23, 2008

Recent Posts

Ravi: sorry - I don't know the answers. You can 'bump' this posting again and I am sure someone will be able to help.
Ravi Teja
RE: How to Increase and Decrease the Textsize in Portal pages
March 21, 2013 4:00 AM
Answer

Ravi Teja

Rank: New Member

Posts: 21

Join Date: July 9, 2012

Recent Posts

hai daniels,
thanks for your help.
Finally i got the solution .here....

i think This code will help to some one like me emoticon

Thanks&regards
Ravi
Hitoshi Ozawa
RE: How to Increase and Decrease the Textsize in Portal pages
March 21, 2013 7:07 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

Are you sure you got an answer? The link to the thread seems to go unanswered.
Ravi Teja
RE: How to Increase and Decrease the Textsize in Portal pages
March 21, 2013 8:06 AM
Answer

Ravi Teja

Rank: New Member

Posts: 21

Join Date: July 9, 2012

Recent Posts

Hitoshi Ozawa:
Are you sure you got an answer? The link to the thread seems to go unanswered.



Hi Hitoshi,
Actually i got solution & posted a thread with example (peace of code). but it is showing this message.

Status: Denied
Your message has been flagged as spam. An administrator will review your message as soon as possible.


weather my post is successfully posted or not?


Thanks
Ravi
Hitoshi Ozawa
RE: How to Increase and Decrease the Textsize in Portal pages
March 21, 2013 3:59 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

Saw your other thread. Seems like you got it. emoticon