DotNetNuke Skins and Resources by ThinkofDesign

Background: 0 1 2 3 4 5 | Easy links (Off) | Text Size: S M L X

Forums

Randon background image

    Hello
I am trying to have a random background image for my dnn 4.3.4 site.I don't think that we can do it with CSS ,so I tried to do it with the body tag of my html skin and it's not working at all,I cannot even place a background image with that tag using inline CSS.Any help will be appreciated.
 thanks
Hey,

You can't have a body tag in your skin... it's already in the default.aspx.

You need a script to do the trick.

See the attached txt file.

Cheers

Attachment: randomBG.txt

I'll try it and let you know ,thanks a lot for your help

Hello

Finally I found a piece of java script code to implement a random background image and it work fine in ascx skins.My only problem is how to stop the background image from repeating,I tried many time to mess with the code but nothing work.Can please take a look of the code to see how to do it? thanks


Attachment: randomBack.txt

here is the code


Attachment: randomBack.txt

Add the line below at the bottom of your script:

document.body.style.backgroundRepeat = 'no-repeat';

Hello

I tried to use this code before found at w3schools (http://www.w3schools.com/htmldom/prop_style_backgroundrepeat.asp)

It did not work I get a blank background no more image,and here is the code


Attachment: background.txt

Replace the lines below:

document.body.background = backgr;
document.body.style.backgroundRepeat = 'no-repeat';

with this line:

document.body.style.background = 'url(\'' + backgr + '\') no-repeat';
Hurraaaaaah,this time It did work,that was the solution.Thanks a lot for your help,God bless you.



ActiveForums 3.7