elfgirl: (dreamwidth)
elfgirl ([personal profile] elfgirl) wrote in [community profile] getting_started2009-05-04 10:17 am

Rotating Headers in Transmogrified?

I know that Transmorgrified allows headers, but does anyone know if it's possible to set custom CSS up for rotating headers (display a randomly selected header from a set group of available headers)? I've seen folks on LJ with their styles set up to do this and I do it myself in my WP journal, but I've no idea how to do it with custom CSS here.

Thanks!


Sorted! From the instructions found here:

NOTE: This solution is only workable with custom theme layers, which means you have to have some sort of paid account. It may or may not work with the other S2 DW themes. (ETA: it also works with Negatives.)



1. Create a custom theme layer by going to Organize > Select style > Developer Area > Your Layers and selecting Create layout-specific layer, type: theme, layout: transmogrified

2. Add the following code to your theme layer:

function Page::print_custom_head()
{
var string[] header_image;
var int header_index=0;

$header_image[$header_index++] = "http://www.imageaddy.com/header_1.jpg";

$header_image[$header_index++] = "http://www.imageaddy.com/header_2.jpg";

$header_image[$header_index++] = "http://www.imageaddy.com/header_3.jpg";

var string header_url = $header_image[rand($header_index) - 1];

    """
    <style type="text/css">   

#header {
    background-image: url("$header_url"); /* Header image URL */
    height: 140px;
    background-scroll: no-scroll;
    background-repeat: no-repeat;
    background-position: center;

}

#header h1 {
    display: none;
}

#header h2 {
    display: none;
}


     </style>
     """;
}


Replace the "http://www.imageaddy.com/header_1.jpg" with the URL of whatever images you'd like to use for your rotating headers. Change the height under the #header CSS code to whatever the height of your header is.

3. Click the Compile and Save button in the top left corner.

4. Go to Organize > Select journal style > Your custom layers and choose the custom Transmogrified layer.
htbthomas: (ohnoes! Jimmy SR)

[personal profile] htbthomas 2009-05-04 09:33 pm (UTC)(link)
Well, I know what I have at my DW now is clunky and unstylish... Sort of why I wanted the CSS for doing something nicer with a header in Core 2...

*cowers in corner* ;)