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

    New tip : Change the background in function of the gender of the poster

    Shadow
    Shadow
    Manager
    Manager


    Male Posts : 16208
    Reputation : 1832
    Language : French, English

    New tip : Change the background in function of the gender of the poster Empty New tip : Change the background in function of the gender of the poster

    Post by Shadow July 17th 2012, 4:04 pm

    Change the background in function of the gender of the poster


    1. Definition :

    So that this tip works, it is necessary that the field "gender" is visible in the messages profile and this, with a picture and not only the text ! We are going to create a CSS additional class fa_postbody_xy (for the boys) and fa_postbody_xx (for the girls) to the message body according to the informed gender, and with this new class, we'll be able to personalize the design of the post by manipulating its CSS.

    2. The codes :

    Administration Panel New tip : Change the background in function of the gender of the poster Arrow10 Modules New tip : Change the background in function of the gender of the poster Arrow10 HTML & Javascript New tip : Change the background in function of the gender of the poster Arrow10 Javascript codes management
    New tip : Change the background in function of the gender of the poster AjouterCreate a new Javascript to apply "in the topics".


    • Title : (What you want)
    • Placement : in the topics
    • Javascript code :
      Code:

      $(function() {
         
         //Indicate here the version of your forum.
         var version = "phpBB3";
         
         if(version.toLowerCase() == "phpbb2"){   
            $(".postdetails img[title='Male']").closest('.postdetails').parent('td').next('td').addClass("fa_postbody_xy");
            $(".postdetails img[title='Female']").closest('.postdetails').parent('td').next('td').addClass("fa_postbody_xx");
         }else if(version.toLowerCase() == "phpbb3"){   
            $(".postprofile img[title='Male']").closest('.postprofile').prev('.postbody').addClass("fa_postbody_xy");
            $(".postprofile img[title='Female']").closest('.postprofile').prev('.postbody').addClass("fa_postbody_xx");   
         }else if(version.toLowerCase() == "punbb"){   
            $(".user-info img[title='Male']").closest('.postmain').addClass("fa_postbody_xy");
            $(".user-info img[title='Female']").closest('.postmain').addClass("fa_postbody_xx");   
         }else if(version.toLowerCase() == "invision"){         
            $(".postprofile img[title='Male']").closest('.post-container').addClass("fa_postbody_xy");
            $(".postprofile img[title='Female']").closest('.post-container').addClass("fa_postbody_xx");
         }
      });


    Important!: To make it works you absolutely need to indicate the version of your forum by editing the value of the variable version, you have the choice between phpBB2, phpBB3, punBB and Invision.


    3. Personalization of the CSS :

    For example, here we have a CSS which act on the 2 classes that we have set up, thanks to the javascript a background picture will be applied, different depending on your skill and your imagination. Smile

    Administration Panel New tip : Change the background in function of the gender of the poster Arrow10 Display New tip : Change the background in function of the gender of the poster Arrow10 Colors and pics New tip : Change the background in function of the gender of the poster Arrow10 Colors New tip : Change the background in function of the gender of the poster Arrow10 CSS stylesheet


    Code:

    .fa_postbody_xy{
       background: url("http://i45.servimg.com/u/f45/17/45/19/77/xy10.png");
    min-height: 500px;
    }
     
    .fa_postbody_xx {
       background: url("http://i45.servimg.com/u/f45/17/45/19/77/xx10.png");
    min-height: 500px;
    }

    4. The results :
    New tip : Change the background in function of the gender of the poster Sin_ta37

    It's done ! cheers cheers cheers


    Translated and updated by the Forumotion Staff

    Tutorial created by : Turbodeif - 06.20.12, from the Spanish Support Forum
    Copyright©️ FORUMOTION.COM



      Current date/time is November 12th 2024, 12:21 am