The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

HOT next to topic

2 posters

Go down

HOT next to topic Empty HOT next to topic

Post by FrOsTyXi December 27th 2014, 12:57 am

@JScript would you know why this code is not working?

New JavaScript
Placement Subforums
Code:
    $(document).ready(function(){
    $('thead:contains("Replies")').each(function() {
      $(this).parents('.main-content').find('td.tc2').each(function() {
      var number = $(this).text();
      var hot = '<span class="hot_topic">HOT</span>';
    if(number >= 5) {
      $(this).append(hot);
    }
      });
    });
    });

CSS
Code:
    .hot_topic {
    background: #ED7710;
    display: block;
    height: 16px;
    margin: 0 auto;
    max-width: 45px;
    line-height: 16px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    color: #fff;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    vertical-align: middle;
    }


Forum Link: TPSN

forum type: punBB
Thank you for the help in advance!
FrOsTyXi
FrOsTyXi
Forumember

Male Posts : 460
Reputation : 12
Language : english

http://team-psn.forum-board.net/

Back to top Go down

HOT next to topic Empty Re: HOT next to topic

Post by _Twisted_Mods_ December 27th 2014, 3:13 am

try this

Code:
    $(document).ready(function(){
    $('.tc3').each(function() {
      $(this).each(function() {
      var  numb = $(this).text().replace(/(Replies\d+ Views)/,'')
      var hot = '<span class="hot_topic">HOT</span>';
    if(numb >= 5) {
      $(this).parent().find(">:first-child").append(hot);
    }
      });
    });
    });
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2108
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

HOT next to topic Empty Re: HOT next to topic

Post by FrOsTyXi December 27th 2014, 4:06 am

Didnt do it either thanks @_Twisted_Mods_
FrOsTyXi
FrOsTyXi
Forumember

Male Posts : 460
Reputation : 12
Language : english

http://team-psn.forum-board.net/

Back to top Go down

HOT next to topic Empty Re: HOT next to topic

Post by _Twisted_Mods_ December 27th 2014, 4:44 am

my fault i missed a ;


Code:
    $(document).ready(function(){
    $('.tc3').each(function() {
      $(this).each(function() {
       var  numb = $(this).text().replace(/(Replies\d+ Views)/,'');
      var hot = '<span class="hot_topic">HOT</span>';
    if(numb >= 5) {
      $(this).parent().find(">:first-child").append(hot);
    }
      });
    });
    });
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2108
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

HOT next to topic Empty Re: HOT next to topic

Post by FrOsTyXi December 27th 2014, 4:50 am

@_Twisted_Mods_ Thank you sir that worked great just needs abit of styling now *)
FrOsTyXi
FrOsTyXi
Forumember

Male Posts : 460
Reputation : 12
Language : english

http://team-psn.forum-board.net/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum