Border change color then there's new post
3 posters
Page 1 of 1
Border change color then there's new post
Hello.
I want to do that border-top color will change, then the new post appeared, or then the new post in categories.
css code:
it only work on one categorie, and its working even there is no new posts.
I want to do that border-top color will change, then the new post appeared, or then the new post in categories.
css code:
- Code:
.lastpost {
width: 150px;
padding: 15px;
background: #F7F7F7;
text-align: center;
font: 700 8px/120% Montserrat, sans-serif;
text-transform: uppercase;
color: #777;
display: block;
overflow: hidden;
margin-left: 160px;
border-top: 10px solid;
border-top-color: #000000; /* Pradinė spalva (juoda) */
transition: border-top-color 0.5s ease; /* Pritaikyti spalvos pakeitimui animaciją */
}
.lastpost.new {
border-top-color: #ff0000; /* Naujo pranešimo spalva (raudona) */
}
- Code:
function addNewPost() {
var lastpostElement = document.querySelector('.lastpost');
lastpostElement.style.borderTopColor = '#ff0000';
}
// addNewPost() after time
setTimeout(addNewPost, 2000);
it only work on one categorie, and its working even there is no new posts.
Last edited by unownus on June 26th 2023, 1:55 pm; edited 1 time in total
unownus- New Member
- Posts : 6
Reputation : 1
Language : lithuanian
Re: Border change color then there's new post
Dear @unownus
can you provide your forum URL and your forum version? (phpBB3, phpBB2, Invision, PunBB, AwesomeBB, ModernBB)
Thanks a lot
also, are we talking about this part? the last column?
can you provide your forum URL and your forum version? (phpBB3, phpBB2, Invision, PunBB, AwesomeBB, ModernBB)
Thanks a lot
also, are we talking about this part? the last column?
unownus likes this post
Re: Border change color then there's new post
oh sorry, i forgot
forum: https://afterdark.forumlt.com/
version: phpBB2
and yes, im talking about the last column
forum: https://afterdark.forumlt.com/
version: phpBB2
and yes, im talking about the last column
unownus- New Member
- Posts : 6
Reputation : 1
Language : lithuanian
Re: Border change color then there's new post
Are you sure it is not phpBB3? because some parts in the code are from phpBB3 and not phpBB2
In the meantime, go to your CSS stylesheet from the ACP and add this - to add the border
In the meantime, go to your CSS stylesheet from the ACP and add this - to add the border
- Code:
.lastpost {
border-top: 6px solid black;
}
.lastpost.new {
border-top: 6px solid red!important;
}
TonnyKamper likes this post
Re: Border change color then there's new post
Good afternoon!
Is your request complete?
if your request is complete, please mark it as Solved.
Is your request complete?
if your request is complete, please mark it as Solved.
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Re: Border change color then there's new post
yes, im sure it's phpBB2Niko wrote:Are you sure it is not phpBB3? because some parts in the code are from phpBB3 and not phpBB2
In the meantime, go to your CSS stylesheet from the ACP and add this - to add the border
- Code:
.lastpost {
border-top: 6px solid black;
}
.lastpost.new {
border-top: 6px solid red!important;
}
it can be some codes from phpBB3, because im new in coding, so i dont know everything
but it's still not working somehow..
i think the problem can be in javascript
unownus- New Member
- Posts : 6
Reputation : 1
Language : lithuanian
Re: Border change color then there's new post
@unownus and can you confirm that you added this code in ACP > Display > Images & Colors > Colors > CSS Stylesheet and then saved?
because the code works for me
- Code:
.lastpost {
width: 150px;
padding: 15px;
background: #F7F7F7;
text-align: center;
font: 700 8px/120% Montserrat, sans-serif;
text-transform: uppercase;
color: #777;
display: block;
overflow: hidden;
margin-left: 160px;
border-top: 10px solid #000000!important;
transition: border-top-color 0.5s ease;
}
.lastpost.new {
border-top-color: #ff0000!important
}
because the code works for me
Re: Border change color then there's new post
no, it's still doesn't work..
unownus- New Member
- Posts : 6
Reputation : 1
Language : lithuanian
Re: Border change color then there's new post
@unownus checking your CSS code, the code I mentioned above is not present
can you keep it installed?
can you keep it installed?
Re: Border change color then there's new post
Good afternoon!
You've changed the phpbb2 templates quite a bit. This template is unrecognizable.
Unfortunately, I was never able to register on your forum, so I worked with what is available as a guest.
Since you don't use forum icons, there is another way to check for new messages - the image-link to the last post ( https://2img.net/i.postimg.cc/PJKCr4Rs/OLD.png ). I don't know the link to the image responsible for the unread new message on your forum.
If there are new posts in the forum section, the border will be red, but if the user read the last post in the section and there are more new posts in it, the border will still change color to black.
AP - Display - Templates - General - index_box
At the end of the template, insert the code:
Save. Publish.
Result:
Pay attention to this line. This is where the link to the image should be inserted.
You've changed the phpbb2 templates quite a bit. This template is unrecognizable.
Unfortunately, I was never able to register on your forum, so I worked with what is available as a guest.
Since you don't use forum icons, there is another way to check for new messages - the image-link to the last post ( https://2img.net/i.postimg.cc/PJKCr4Rs/OLD.png ). I don't know the link to the image responsible for the unread new message on your forum.
If there are new posts in the forum section, the border will be red, but if the user read the last post in the section and there are more new posts in it, the border will still change color to black.
AP - Display - Templates - General - index_box
At the end of the template, insert the code:
- Code:
<script>
window.addEventListener('load', function() {
let newMes = document.querySelectorAll('img[src="LINK TO UNREAD MESSAGE ICON"]');
let noNewMes =document.querySelectorAll('img[src="https://2img.net/i.postimg.cc/PJKCr4Rs/OLD.png"]');
newMes.forEach(item => {
item.closest('.lastpost').style.borderTopColor = 'red';
item.closest('.lastpost').style.borderTopWidth = '5px';
item.closest('.lastpost').style.borderTopStyle = 'solid';
});
noNewMes.forEach(item => {
item.closest('.lastpost').style.borderTopColor = 'black';
item.closest('.lastpost').style.borderTopWidth = '5px';
item.closest('.lastpost').style.borderTopStyle = 'solid';
});
});
</script>
Save. Publish.
Result:
Pay attention to this line. This is where the link to the image should be inserted.
- Code:
let newMes = document.querySelectorAll('img[src="LINK TO UNREAD MESSAGE ICON"]');
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
TonnyKamper and unownus like this post
Re: Border change color then there's new post
thank you, now it's working
unownus- New Member
- Posts : 6
Reputation : 1
Language : lithuanian
Razor12345- Support Moderator
- Posts : 1586
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine
Similar topics
» How to Change the rounded border color?
» How do you change the color of your post?
» How can I change the post-color text?
» Getting rid/changing the color of a random white border under some headers
» Post Details Text Color change!
» How do you change the color of your post?
» How can I change the post-color text?
» Getting rid/changing the color of a random white border under some headers
» Post Details Text Color change!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum