- Posts: 147
COMMUNITY FORUM
Font Increase
- Mats Arvendal
-
Topic Author
- Offline
- Premium Member
I have styled my Intro text to 120 % and it doesn't change when clicking the increase icon, only the body text (74 %) changes.
Rgds
Please Log in or Create an account to join the conversation.
- Austin Saucier
-
- Offline
- New Member
- Posts: 7
1. Go to your file directory and open the file: /components/com_k2/js/k2.js
2. Look for the Text Resizer section of the code (around line 31) and make this change:
Change this:
// Text Resizer
if ($('fontDecrease')) {
$('fontDecrease').addEvent('click', function(e){
new Event(e).stop();
$$('.itemFullText').removeClass('largerFontSize');
$$('.itemFullText').addClass('smallerFontSize');
});
}
if ($('fontIncrease')) {
$('fontIncrease').addEvent('click', function(e){
new Event(e).stop();
$$('.itemFullText').removeClass('smallerFontSize');
$$('.itemFullText').addClass('largerFontSize');
});
}
To this:
// Text Resizer
if ($('fontDecrease')) {
$('fontDecrease').addEvent('click', function(e){
new Event(e).stop();
$$('.itemIntroText').removeClass('largerFontSize');
$$('.itemFullText').removeClass('largerFontSize');
$$('.itemIntroText').addClass('smallerFontSize');
$$('.itemFullText').addClass('smallerFontSize');
});
}
if ($('fontIncrease')) {
$('fontIncrease').addEvent('click', function(e){
new Event(e).stop();
$$('.itemIntroText').removeClass('smallerFontSize');
$$('.itemFullText').removeClass('smallerFontSize');
$$('.itemIntroText').addClass('largerFontSize');
$$('.itemFullText').addClass('largerFontSize');
});
}
3. Now you can check the frontend to make sure the font resizer works for both the introtext and fulltext.
4. To change the smaller and larger font sizes, open the file: /components/com_k2/css/k2.css
5. Scroll down a bit (or do a code search) and find the classes: .smallerFontSize and .largerFontSize
6. Change these to whatever font sizes suit your needs.
Hope that helps. Cheers.
Please Log in or Create an account to join the conversation.
- Mats Arvendal
-
Topic Author
- Offline
- Premium Member
- Posts: 147
I tried your solution but it didn't seem to have any effect on the intro text. Only the body text is resizing after the alterations of the k2.js file. This result was kinda strange since your solution seemed quite straight forward and very logical. But no, the problem with the intro text still exist.
I found the css class now. Thanks!
Please Log in or Create an account to join the conversation.
- Austin Saucier
-
- Offline
- New Member
- Posts: 7
Please Log in or Create an account to join the conversation.
- Mats Arvendal
-
Topic Author
- Offline
- Premium Member
- Posts: 147
Please Log in or Create an account to join the conversation.
- Austin Saucier
-
- Offline
- New Member
- Posts: 7
Please Log in or Create an account to join the conversation.
- Mats Arvendal
-
Topic Author
- Offline
- Premium Member
- Posts: 147
But I noticed when I checked the source code of the generated HTML-pages that if I only write text in intro it gets the css class="itemFullText", thus allowing everything to work. But I guess this has nothing to do with it.
I was prepared to abandon K2:s font resizer and use some other script, but then I discovered that such scripts seem to collide with PNG-fix script for IE6 so I am in a cul-de-sac.
Please Log in or Create an account to join the conversation.
- Austin Saucier
-
- Offline
- New Member
- Posts: 7
The way the font resizer feature works is that when you click the increase/decrease font button, the javascript searches the page for both of the div tags I mentioned above. Once it finds them, it inserts a new css class into both of them. So before you click an increase/decrease button, the introtext code should look like this:
{div class="itemIntroText"},{p}Your introtext here......{/p}
{/div}
After you click the font increase/decrease button it should look like this (if you're using Firebug):
{div class="itemIntroText largerFontSize"},{p}Your introtext here......{/p}
{/div}
* I had to use the curly brackets ( {} ) in this response box because it was stripping out my regular brackets ( <> ) *
If this change does not occur, you might need to recheck your javascript again to make sure you copied it correctly (happens to me all the time).
Please Log in or Create an account to join the conversation.
- Mats Arvendal
-
Topic Author
- Offline
- Premium Member
- Posts: 147
But the result is still like this:
What's peculiar is the strike-through on the attbributes on the .largerfontsize
Rgds
Please Log in or Create an account to join the conversation.
- Austin Saucier
-
- Offline
- New Member
- Posts: 7
.largerFontSize {font-size: XXX% !important;line-height: XXX% !important;}
.smallerFontSize {font-size: XXX% !important;line-height: XXX% !important;}
Please Log in or Create an account to join the conversation.
- Mats Arvendal
-
Topic Author
- Offline
- Premium Member
- Posts: 147
It works. Thanks a lot for your patience and great help!
Rgds
Please Log in or Create an account to join the conversation.
- Austin Saucier
-
- Offline
- New Member
- Posts: 7
Cheers
Please Log in or Create an account to join the conversation.
- scyllar
-
- Offline
- Senior Member
- Posts: 60
Please Log in or Create an account to join the conversation.