Results 1 to 2 of 2

Thread: Add additional p tag to Photo Album script?

  1. #1
    Join Date
    Nov 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Add additional p tag to Photo Album script?

    1) Script Title: Photo Album

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...photoalbum.htm

    3) Describe problem: I'd like to add a <p> tag for the optional description text so that I can style it with css, but I have no idea where to add it. Any help appreciated !

    Thanks !
    Shirley

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    First of all, all text appearing in the description can be styled using this hook:

    Code:
    .slideshow { /*CSS for DIV containing each image*/
    float: left;
    width: 200px;
    height: 270px;
    }
    In the stylesheet, for example:

    Code:
    .slideshow { /*CSS for DIV containing each image*/
    float: left;
    width: 200px;
    height: 270px;
    text-align:center;
    font-family:arial, sans-serif;
    font-size:90%;
    }
    If you add some style in there that has an adverse effect upon the image's appearance, it can almost always be negated here:

    Code:
    .slideshow img { 
    width: 174px;
    height: 146px;
    }
    If that is enough, then it is better not to add a <p> element. If you have to add an element, a <div> or even a <span> would probably be better choices. It is in the function buildimage(i) that you can add one of these:

    Code:
    function buildimage(i){
    var tempcontainer=galleryarray[i][3]!=""? '<a href="'+galleryarray[i][3]+'" target="'+href_target+'">' : ""
    tempcontainer+='<img src="'+galleryarray[i][0]+'" border="1" title="'+galleryarray[i][1]+'">'
    tempcontainer=galleryarray[i][3]!=""? tempcontainer+'</a>' : tempcontainer
    tempcontainer=galleryarray[i][2]!=""? tempcontainer+'<br \/>'+galleryarray[i][2] : tempcontainer
    return tempcontainer
    }
    To add a span change it to:

    Code:
    tempcontainer=galleryarray[i][2]!=""? tempcontainer+'<br \/><span>'+galleryarray[i][2]+'<\/span>' : tempcontainer
    To add a division, use (note - the br tag is removed as a div will add a linebreak of its own):

    Code:
    tempcontainer=galleryarray[i][2]!=""? tempcontainer+'<div>'+galleryarray[i][2]+'<\/div>' : tempcontainer
    The style hooks for these would be:

    Code:
    .slideshow span { 
    style rules here
    }
    and:

    Code:
    .slideshow div { 
    style rules here
    }
    respectively.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •