Dynamic setting of container background image - service portal

jasonalldridge
Kilo Expert

We need to be able to dynamically change the background image set in the container the Homepage search widget resides in on the main landing page of the service portal.

As such we need to be able to get to the container element to set the background image in the link function, and the only way we've been able to find this element is by using the following:

 

function(scope, element){
	var d = $(element).parent().parent().parent().parent().parent().parent().parent()[0];
	d.style.backgroundImage = 'url('+scope.data.image+')';
}

However the downside is that if the DOM changes this will fail.

 

Can anybody recommend a better way of doing this? 

$('.cbe98a8d2cb20020000f8d856634c9c63').css("background-image","url('+c.data.image+')"); doesnt work due to JQuery restriction in the portal.

 

Cheers

7 REPLIES 7

Community Alums
Not applicable

Hi All,

Did anyone get anywhere with this?

I have a requirement to change the portal background based on users location or company.

Any advice would be appreciated.

Thanks!
Alex

Hi All,
I have the same requirement. Does anyone have any solution to this?

 

JamesAcevedo88
Tera Contributor

I want to learn to do this. Does anybody have a solution?