0

I'm not sure if I'm using the correct terminology to describe what I'm looking for but it's the best I could come up with.

Essentially I have a list of items that I'm currently displaying in DIVs. I'm using the jQuery UI plug-ins and hooking up styles to toggle when the user hovers over each item. Now I'd like to have a small toolbar-like set of buttons appear in the upper-right corner of each item when the mouse hovers over that item. When the mouse moves up or down to the next item, the toolbar "moves" to that item. Of course, it doesn't really move - I'm assuming that I'm toggling the visibility of a toolbar associated with each item.

The latter point is due to a couple of factors including that the buttons are encoded with the id value for each list item so the command knows which item to work against.

What I need to know is how to create the HTML and CSS so that I can have a DIV with contents that are unaffected by the display of the toolbar. And the markup and style settings to get the toolbar to appear in the upper-right corner of each item, above the existing content.

UPDATE

I basically have a <DIV> wrapper that contains another <DIV> with text and another <DIV> that contains a set of image buttons (images wrapped in anchors). What I need is the HTML and CSS so that the <DIV> (or whatever other element is required to make it work) containing the buttons appears to float in the top-right corner of the parent <DIV> as shown in the picture below:

enter image description here

I can then use jQuery to show and hide the buttons when the item is hovered.

1
  • 3
    Can you at least post some HTML and JS that to give us an idea of what you're shooting for? Lol "Hooking up styles" ...sorry couldn't help it :]
    – pixelbobby
    Commented May 9, 2011 at 18:51

1 Answer 1

1

If you ONLY need the HTML/CSS you could do something like this:

CSS
/* this contain both your injected JS and your current content */
.highlight { background:#ddd; position:relative; overflow:auto; padding:15px;}
.highlight * {margin:0; padding:0;}
/* you will place your action buttons here, they seem to be: delete, promote, demote */
.highlight .nav { position:absolute; top:0; right:0; background:#333; list-style-type:none; }
.highlight .nav li {float:left; margin:0 1px; list-style-type:none;}
/* add the styles per each button, they will all look the same for now */
.highlight .nav li a {display:block; height:15px; width:10px; background:red; text-indent:-9999px; cursor:pointer;}

HTML
<div class="highlight">
  <ul class="nav">
    <li><a>DELETE</a></li>
    <li><a>PROMOTE</a></li>
    <li><a>DEMOTE</a></li>
  </ul>
 <p>your current content will be here, could also be a div or anything else, it just needs to be sitting inside the .hightlight div</p>
</div>

EDIT: Updated with the code I posted at http://jsfiddle.net/edCD3/

Good luck, Leo

4
  • This doesn't even come close to working. Besides showing the "toolbar" in the top-left (which is a minor thing), there is no overlay so it shows with the word "DELETE" at the top, a nice sized break then the paragraph text. Not what I'm looking for. If you feel I am wrong, please update your post with the complete HTML and CSS that works for you and I'll give it another try. Commented May 11, 2011 at 17:38
  • Sorry seems that I was making some typos and not getting some classes, here it goes again: jsfiddle.net/edCD3
    – leopic
    Commented May 12, 2011 at 6:46
  • Too funny. The JSFIDDLE site is doing almost exactly what I want. When you hover the mouse over the HTML box, you'll see the CSS, JavaScript and Result balloons over the other boxes. Move the mouse over the CSS box and that one disappears and the HTML balloon appears. This is what I'm looking for except in reverse - when I hover over CSS, that balloon should appear and all others hide. I can handle that part using jQuery. I had to play with your code a bit (p to span, add width:100% to highlight) but it looks like its working. I'll see if I can get it working in my site next. Commented May 12, 2011 at 13:12
  • It took a while but I was finally able to double-back to this project and verify the solution. Commented Nov 17, 2011 at 15:05

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.