Options

how to display a front page photo

mojonesmojones Registered Users Posts: 13 Big grins
I just got an account with smugmug and I've been playing around with the available options. I wanted to display a 'front page' photo & caption on my homepage, but the options only allow a single header html block for all pages. Here's how to do it using javascript - this goes in the 'header' box on the customise page. It simply checks if the URL is that of the homepage, and inserts a photo and caption if it is. See it in action here:

http://mojones.smugmug.com

Hope this is of use/interest to someone.
mj
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
var myString = location.href;

if (myString=="http://mojones.smugmug.com/"){
document.writeln('<br><img src="http://mojones.smugmug.com/photos/27497329-M.jpg" width="600" height="399"> <br><H3>Edinburgh castle from Blackford hill</H3><hr>');
}

//-->
</SCRIPT>

Comments

  • Options
    AndyAndy Registered Users Posts: 50,016 Major grins
    edited July 11, 2005
    that's pretty cool!
  • Options
    lynnmalynnma Registered Users, Retired Mod Posts: 5,207 Major grins
    edited July 11, 2005
    That is cool.. now can you write something so that several pictures rotate through? a slide show?:D
  • Options
    USAIRUSAIR Registered Users Posts: 2,646 Major grins
    edited July 11, 2005
  • Options
    asdasd Registered Users Posts: 115 Major grins
    edited July 12, 2005
    Very sweet - thanks for posting about this. clap.gif
  • Options
    mojonesmojones Registered Users Posts: 13 Big grins
    edited July 12, 2005
    lynnma wrote:
    That is cool.. now can you write something so that several pictures rotate through? a slide show?:D

    I'll look into it.... that was actually the first bit of javascript I've every hacked together, so a little bit more study may be required..
  • Options
    lynnmalynnma Registered Users, Retired Mod Posts: 5,207 Major grins
    edited July 12, 2005
    mojones wrote:
    I'll look into it.... that was actually the first bit of javascript I've every hacked together, so a little bit more study may be required..
    :D
  • Options
    brjphotobrjphoto Registered Users Posts: 168 Major grins
    edited June 22, 2006
    Not working for me...
    I can't get this to work for me. Does anyone have any idea why? Nothing shows up. Just the normal header.

    www.brjphoto.smugmug.com

    Thanks.
    mojones wrote:
    I just got an account with smugmug and I've been playing around with the available options. I wanted to display a 'front page' photo & caption on my homepage, but the options only allow a single header html block for all pages. Here's how to do it using javascript - this goes in the 'header' box on the customise page. It simply checks if the URL is that of the homepage, and inserts a photo and caption if it is. See it in action here:

    http://mojones.smugmug.com

    Hope this is of use/interest to someone.
    mj
    <SCRIPT LANGUAGE="JAVASCRIPT">
    <!--
    var myString = location.href;
    
    if (myString=="http://mojones.smugmug.com/"){
    document.writeln('<br><img src="http://mojones.smugmug.com/photos/27497329-M.jpg" width="600" height="399"> <br><H3>Edinburgh castle from Blackford hill</H3><hr>');
    }
    
    //-->
    </SCRIPT>
    
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited June 22, 2006
    brjphoto wrote:
    I can't get this to work for me. Does anyone have any idea why? Nothing shows up. Just the normal header.

    www.brjphoto.smugmug.com

    Thanks.
    Hi brjphoto,

    hmm...this code is somewhat dodgy IMO. Are you looking for just a single photo or perhaps a slideshow ?

    If you're in fact after a slideshow, a hack is already written.

    Otherwise, let me know and I write something a bit more robust.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
Sign In or Register to comment.