0

I want to change the background of the page with title ='Home' for example, and I want to do it by lightning component.

I know that the Id of the page is NapiliCommunityTemplate ,

how to do this? can I reach the page style from the component?, or is there another way to do it.

Note: community is single page application so by builder I can set style which applied to all pages but not to specific one.

I tried this:

if(document.title.indexOf("Home")>=0)
        {
            alert(document.title); 

            var divx = document.getElementById('NapiliCommunityTemplate');// this return null
            divx.style.backgroundColor = '#FF0000';
        }
        else
        {
            alert("Not FOund");                     
        }

Please help.

1

You have to create a Custom Theme Layout and apply it to the Home Page through the Page Properties:

enter image description here

Under Layout > Theme Layout Type:

enter image description here

1
  • thanks for you answer.. I think its correct and I will try ... but why css condition does not work with community ? – sundus Jul 25 '17 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.