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.
The forum of the forums
2 posters

    Message Background Javascript Not working as Well

    SpyroDragon
    SpyroDragon
    Forumember


    Posts : 462
    Reputation : 2
    Language : English

    Message Background Javascript Not working as Well Empty Message Background Javascript Not working as Well

    Post by SpyroDragon May 25th 2015, 12:18 am

    As well as the name color, my background javascript has seemed to stop working, unless iv screwd the script up somehow


    Code:
    $(function() {
     customBg('Spyro ▀█▀ Dragon', 'Spyro-background', 'http://i19.servimg.com/u/f19/16/87/57/90/spyro_10.jpg');
     
      function customBg(name, classname, image) {
        var ua = window.navigator.userAgent, td = 'td', pos = '';
        $('.post:has(.name:contains('+name+'))').addClass(classname);
        if (ua.match(/Chrome/)) td = 'td:last-child', pos = '140% 0';
        if (ua.indexOf('MSIE ') > 0 || ua.match(/Trident/) || ua.match(/Chrome/)) $('head').append('<style type="text/css">.post.'+classname+' > '+td+' { background:none }.post.'+classname+' {background: url('+image+') no-repeat '+pos+' transparent }</style>');
        else $('head').append('<style type="text/css">.post.'+classname+' td { background:none }.post.'+classname+' {background: url('+image+') no-repeat center center / 100% 100% transparent }</style>');
      }
    });
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3283
    Reputation : 254
    Language : English, Italian, French
    Location : Italy

    Message Background Javascript Not working as Well Empty Re: Message Background Javascript Not working as Well

    Post by Niko May 25th 2015, 4:31 pm

    Hello @SpyroDragon

    it seems that the code works correctly and that there are no errors in de syntax Wink

    Have you installed other javascripts before this one?

      Current date/time is November 11th 2024, 5:29 pm