This entry is part of a series, Sliding Notes Advice»

Without wingsThe other day I posted about the side-effect when the slider title is formated directly, therewith effectively inserting HTML tags into it. Instead I suggested using CSS to format the title.

CSS also comes in handy for adding an image» to the slider button.

This is how it is done:

  1. Since inline elements cannot have a hight, you’ll need an image small enough to fit a single line of text, like a smiley :) . It’s height shouldn’t exceed 16px.
  2. Use the bstyle shortcode parameter to style an individual slider button, and apply the following CSS: padding-left:20px; background:url(/path/to/your/images/small_image.gif) 3px center no-repeat
  3. Better yet, put the above CSS into an extra CSS clause, say
    a.hackadelic-sliderButton.left-image {
      padding-left:20px;
      background:url(/path/to/your/images/default_image.gif)
        3px center no-repeat;
    }

    effectively predefining a default style for a button with an image, and then use the type shortcode parameter to apply that styling, and bstyle to override the image:

    type=left-image bstyle="background-image:url(/path/to/your/images/this_image.gif)

  4. If you can identify only a few recurring images, it’d make sense to specify a separate CSS clause, analogous to the one above, for each one of them, and simply use the type parameter to select it (skipping the verbosity of bstyle altogether).

Here is one example of a pre-styled button without image override,» and here’s one WITH image override.»

This one is shown with the default image (here: the “cool” smiley)Powered by Hackadelic Sliding Notes 1.6.3.2
This one is shown with with an own image (here: the “arrow” smiley)Powered by Hackadelic Sliding Notes 1.6.3.2

13 Responses to “Sliding Notes HowTo’s – Adding An Image To The Button”

  1. hi,

    I failed again, :<
    I added the “hackaadelic-sliderButton.left-image” css by using myCSS plugins, but I didn’t see my arrow icon (in png format) up.
    Do I need changes in the short codes?

  2. Patrick, you must excuse my awkwardness: In my sample code, there was an “a” too many:

    hackaaadelic-sliderButton.left-image

    It is sometimes the little things that matter most. ;-)

  3. Eventually, I get it up with some tears, as I fixed two bugs in the short codes, namly “bacground” and a missing ” at the end of the codes

    please see : http://www.ccie.hk/?p=8

    here are my codes on myCSS and the post

    a.hackadelic-sliderButton.left-image {
    padding-left:25px;
    background: url(./archive/rightArrow1.png)
    3px center no-repeat;
    }
    —-

    [slider title="view topology diagram" type=left-image bstyle="background-image: url(./archive/rightArrow2.png)"]

    [/slider]

    However, I am still confused that if it possible to keep the short code simpler, by skipping
    bstyle=”background-image: url(./archive/rightArrow2.png)”
    or even to skip
    type=left-image if I simply use ONE recurring arrow sign?

    PS: I’ve also spent a couple of hours to get from web a RIGHT right arrow sign for my need

  4. … one more bug fixed, type=left-image

  5. Patrick, that’s exactly what my article says. If you mainly use “Array2.png” anyway, make it the default.

    a.hackadelic-sliderButton.left-image {
    padding-left:25px;
    background: url(./archive/rightArrow2.png)
    3px center no-repeat;
    }
    Then you can just write:

    [slider title="view topology diagram" type=left-image]

    Sorry for my typos.

  6. Is there any way to ‘toggle’ the image?
    Say, a ‘down-arrow’ before the Sliding Notes appear, and then ‘up-arrow’ after the Sliding Notes has been revealed.

    If there’s a way, please share it here. Thank you.

  7. works great, thanks!

  8. Forgive my newbie cluelessness, but is there anyway you could give me a code snippet that I could use to replace the button entirely with an image? I’d like to *literally* put a small gif “button” in its place that could be clicked to open the slider. Thanks!

  9. Jannifer, what would a SN version that enables you do do just that very simply be worth to you? :)

  10. :-)

    In a figurative sense it would be extremely useful to me. In the literal sense, I wish I could make a donation towards its development, but all of my own website maintenance expenses come out of my pocket (the site runs in the red as it is) and disability benefits haven’t exactly made me a deep-pocketed financial well, lol.

    Having said that, I would of course be glad to give you a little publicity if the version ever came out–let the people who use my site know how useful I’ve found your fantastic plugin. :-)

  11. :) I see, Jenifer. So you neatly avoided to answer my question. :)

  12. Hackadelic,

    Not at all! I simply don’t have any money, so it’s pointless to say what it would be worth to me, since it would be worth a great deal but I couldn’t pay anyway. Wish I could, since I don’t have the coding skills to figure it out myself. :-(

  13. Oh, it seems I’ve been misunderstood again, Jennifer. I wasn’t mocking you or something. It’s just that in my jargon knowing what something would be worth to me and being able to afford it are two different things.

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please ignore these 2 fields: