Change forum width
2 posters
Page 1 of 1
Change forum width
Is there a script to toggle the page width the default width can be max-width: 1400px and when you click the link or something it should change to max-width: 95% for example.
I'm using phpBB3
@Razor12345 something like XenForo forums have a link at the bottom of the forum.
I'm using phpBB3
@Razor12345 something like XenForo forums have a link at the bottom of the forum.
TonnyKamper likes this post
Re: Change forum width
something like XenForo forums have a link at the bottom of the forum.
I have not used this resource.
I understand correctly - there should be a switch with multiple buttons. When the button is clicked, the width of the forum should change and be saved?
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Re: Change forum width
Razor12345 wrote:something like XenForo forums have a link at the bottom of the forum.
I have not used this resource.
I understand correctly - there should be a switch with multiple buttons. When the button is clicked, the width of the forum should change and be saved?
Can you code something similar is that possible to do so?
Re: Change forum width
AP - Display - Template - General - overall_footer_begin
Find:
Replace by this:
This is us adding a button to the forum footer
At the end of template, insert this script:
Save. Publish.
AP - Display - Colors&CSS - CSS Stylesheet
- the width of the forum after the button is pressed.
Save.
Since we are working with a loaded page in the code, for a couple of seconds the pages will be the width that is set in AP and then become the desired width.
Result:
You can try this code on my test forum: https://testtesttest.forumotion.me/
Find:
- Code:
<ul class="linklist clearfix">
<li class="footer-home">
<a class="icon-home" href="{U_INDEX}" accesskey="h">{L_HOME}</a>
</li>
<li class="rightside">
<!-- BEGIN html_validation -->
</li>
</ul>
Replace by this:
- Code:
<ul class="linklist clearfix">
<li class="footer-home">
<a class="icon-home" href="{U_INDEX}" accesskey="h">{L_HOME}</a>
</li>
<li class='change_width__button'>Change width
</li>
<li class="rightside">
<!-- BEGIN html_validation -->
</li>
</ul>
This is us adding a button to the forum footer
At the end of template, insert this script:
- Code:
<script>
window.addEventListener('load', function() {
if (localStorage.getItem('widthUser')) {
document.querySelector('#wrap').classList.add('changed');
}
const changeWidthBtn = document.querySelector('.change_width__button');
changeWidthBtn.addEventListener('click', function() {
document.querySelector('#wrap').classList.toggle('changed');
if (localStorage.getItem('widthUser')) {
localStorage.removeItem('widthUser');
} else {
localStorage.setItem('widthUser', 'yes');
}
});
});
</script>
Save. Publish.
AP - Display - Colors&CSS - CSS Stylesheet
- Code:
#wrap.changed {
width: 100%;
}
#wrap {
transition: width 0.3s ease;
}
.change_width__button {
margin-left: 10px;
}
|
Save.
Since we are working with a loaded page in the code, for a couple of seconds the pages will be the width that is set in AP and then become the desired width.
Result:
You can try this code on my test forum: https://testtesttest.forumotion.me/
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Sir Chivas™, Mati and TonnyKamper like this post
Re: Change forum width
Thanks it works but there is a problem @Razor12345 when you load the page or going in to the forums the page goes back to 1400px and then the width we set to change so is there any way to eliminate this loading problem?
Re: Change forum width
Mati wrote:Thanks it works but there is a problem @Razor12345 when you load the page or going in to the forums the page goes back to 1400px and then the width we set to change so is there any way to eliminate this loading problem?
Razor12345 wrote:Since we are working with a loaded page in the code, for a couple of seconds the pages will be the width that is set in AP and then become the desired width.
You can use another event -
|
It will still show the forum width set in AP for a second, but my tests have shown that this time is a bit shorter than with
|
- Code:
<script>
window.addEventListener('DOMContentLoaded', function() {
if (localStorage.getItem('widthUser')) {
document.querySelector('#wrap').classList.add('changed');
}
const changeWidthBtn = document.querySelector('.change_width__button');
changeWidthBtn.addEventListener('click', function() {
document.querySelector('#wrap').style.transition = 'width 0.3s ease';
document.querySelector('#wrap').classList.toggle('changed');
if (localStorage.getItem('widthUser')) {
localStorage.removeItem('widthUser');
} else {
localStorage.setItem('widthUser', 'yes');
}
});
});
</script>
In CSS code delete this:
- Code:
#wrap {
transition: width 0.3s ease;
}
The smoothness in the transition I added to the JS code:
|
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Re: Change forum width
I know but it's kind annoying so is that all what we can do or can we fix this issue?
Re: Change forum width
We can hide the block display with CSS, and when the script is running, show the block:
In CSS
JS code:
There's nothing more we can do
In CSS
- Code:
#wrap {
display: none;
}
JS code:
- Code:
<script>
window.addEventListener('DOMContentLoaded', function() {
if (localStorage.getItem('widthUser')) {
document.querySelector('#wrap').classList.add('changed');
}
document.querySelector('#wrap').style.display = 'block';
const changeWidthBtn = document.querySelector('.change_width__button');
changeWidthBtn.addEventListener('click', function() {
document.querySelector('#wrap').style.transition = 'width 0.3s ease';
document.querySelector('#wrap').classList.toggle('changed');
if (localStorage.getItem('widthUser')) {
localStorage.removeItem('widthUser');
} else {
localStorage.setItem('widthUser', 'yes');
}
});
});
</script>
There's nothing more we can do
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Re: Change forum width
The script work but the textarea is geting to long when I added the css #wrap {display: none;} or maybe the script chose the problem.
Re: Change forum width
Strange behavior. Perhaps there is something hidden from us in the post editor.
Let's go back to the
event and change the
property to
JS code:
CSS code:
I added this code:
Because the width of the forum affects the width of the editor.
Let's go back to the
|
|
|
JS code:
- Code:
<script>
window.addEventListener('load', function() {
if (localStorage.getItem('widthUser')) {
document.querySelector('#wrap').classList.add('changed');
}
document.querySelector('#wrap').style.visibility = 'visible';
const changeWidthBtn = document.querySelector('.change_width__button');
changeWidthBtn.addEventListener('click', function() {
document.querySelector('#wrap').style.transition = 'width 0.3s ease';
document.querySelector('#wrap').classList.toggle('changed');
if (localStorage.getItem('widthUser')) {
localStorage.removeItem('widthUser');
} else {
localStorage.setItem('widthUser', 'yes');
}
});
});
</script>
CSS code:
- Code:
#wrap.changed {
width: 100%;
}
#message-box textarea, .sceditor-container iframe, .sceditor-container textarea {
width: 98% !important;
}
#wrap {
visibility:hidden;
}
.change_width__button {
margin-left: 10px;
}
I added this code:
- Code:
#message-box textarea, .sceditor-container iframe, .sceditor-container textarea {
width: 98% !important;
}
Because the width of the forum affects the width of the editor.
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
TonnyKamper likes this post
Re: Change forum width
Is your request complete?
if your request is complete, please mark it as Solved
if your request is complete, please mark it as Solved
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Re: Change forum width
It's been two weeks now. We have not heard back from the author.
I'm closing the topic and moving it to the archive.
If your problem is not solved - send me a private message and I will open this topic for further help.
I'm closing the topic and moving it to the archive.
If your problem is not solved - send me a private message and I will open this topic for further help.
Problem solved & topic archived.
|
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Similar topics
» Change Topic Title width and height
» i need a help about a forum width fix
» How set my forum minimum width same to main logo width
» Change Topic width
» How to change Packages width Credits
» i need a help about a forum width fix
» How set my forum minimum width same to main logo width
» Change Topic width
» How to change Packages width Credits
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum