Displaying Widgets Only on Homepage Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
5 posters

    Displaying Widgets Only on Homepage

    ELTP
    ELTP
    New Member


    Male Posts : 18
    Reputation : 2
    Language : English and Finnish

    Displaying Widgets Only on Homepage Empty Displaying Widgets Only on Homepage

    Post by ELTP November 16th 2017, 3:20 pm

    Technical Details


    Forum version : #Invision
    Position : Founder
    Concerned browser(s) : Google Chrome
    Who the problem concerns : All members
    Forum link : http://www.duelmasters.org

    Description of problem

    I looked into this matter in the help board but couldn't seem to find code for invision forums. So we have widgets on the both sides of the actual forum, and would like to hide them outside the home page.


    ABOVE PROBLEM IS MY MAIN CONCERN but I'd love to have the following problems solved as well.
    I also have problems with hiding the forum name in the navigational category chain (would love to hide it on the homepage as well).

    Then I haven't yet successfully implemented code that would reduce the spacing between different categories thus making the forum feel more "whole".
    avatar
    Mr.SnOuP
    New Member


    Posts : 18
    Reputation : 4
    Language : En & Fr

    Displaying Widgets Only on Homepage Empty Re: Displaying Widgets Only on Homepage

    Post by Mr.SnOuP November 16th 2017, 4:58 pm

    Hello ,

    Go to :
    Administration Panel>  MODULES> HTML & JAVASCRIPT> Javascript codes management
    *Add a new Javascript Code with these Items :
    Title * : as you like
    Placement :In the home page
    *paste this code

    Code:
    $(document).ready( function() {
        var salemh = window.location.href;
        if (salemh === "http://www.duelmasters.org") {
        document.getElementById("left").style.display = 'none';
            document.getElementById("right").style.display = 'none';
    }
           });

    *than SUBMIT
    ELTP
    ELTP
    New Member


    Male Posts : 18
    Reputation : 2
    Language : English and Finnish

    Displaying Widgets Only on Homepage Empty Re: Displaying Widgets Only on Homepage

    Post by ELTP November 23rd 2017, 6:07 pm

    Hi,
    This didn't workout for me. Any other suggestions?
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15275
    Reputation : 1701
    Language : English,Greek
    Location : Greece

    Displaying Widgets Only on Homepage Empty Re: Displaying Widgets Only on Homepage

    Post by skouliki November 23rd 2017, 6:35 pm


    ELTP
    ELTP
    New Member


    Male Posts : 18
    Reputation : 2
    Language : English and Finnish

    Displaying Widgets Only on Homepage Empty Re: Displaying Widgets Only on Homepage

    Post by ELTP November 23rd 2017, 6:59 pm

    I already tried that and it worked wonderdully on our phpBB3 based forum but not on our invision based forum.

    That's why I am asking the code for INVISION here.
    Van-Helsing
    Van-Helsing
    Hyperactive


    Male Posts : 2431
    Reputation : 116
    Language : English, Greek

    Displaying Widgets Only on Homepage Empty Re: Displaying Widgets Only on Homepage

    Post by Van-Helsing November 23rd 2017, 11:44 pm

    Hello,
    Can you please post your forum's link?
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51557
    Reputation : 3519
    Language : English
    Location : United States

    Displaying Widgets Only on Homepage Empty Re: Displaying Widgets Only on Homepage

    Post by SLGray November 23rd 2017, 11:46 pm




    Displaying Widgets Only on Homepage Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Van-Helsing
    Van-Helsing
    Hyperactive


    Male Posts : 2431
    Reputation : 116
    Language : English, Greek

    Displaying Widgets Only on Homepage Empty Re: Displaying Widgets Only on Homepage

    Post by Van-Helsing November 24th 2017, 12:13 am

    Hello @ELTP,
    Thanks @SLGray Smile,
    Please go to ACP(Admin Control Panel) > Modules > HTML & JAVASCRIPT > Javascript codes management > Javascript Codes > Javascript Codes and create a new javascript:

    Name: Disable Widgets
    Placement: In all the pages

    Javascript Code:
    Code:
    jQuery(document).ready(function(){
          if (location.pathname !== '/') {
          jQuery('.module .box-content').css('display','none');
          jQuery('#content').css('margin-right','0px');
          jQuery('#left').css('display','none');
          jQuery('#content').css('margin-left','0px');
          jQuery("div#main").css('width','1260px');
          }
    });

    Then press submit. You can adjust your forum width as you wish.

    It will dynamically hide your widgets in all of the pages except your home page. Smile