That's messy and pretty unelegant:
Using CSS, Javascript and Ajax you can make a seamlessly working
variant of this using a simple link tag and an embedded onclick
function, the webcontroller should retain the functionality so it also
works when javascript is turned off (lo behold). Using CSS styles you
push the text outside of the viewing border, which makes it readable
to screenreaders and display the star icon using background-position.
<a href='/mark/item_123' onclick='toggleFavourite(this)'
class="inactive">Make Favourite</a>
Then when you click it, you 'return false' at the end of the function
outside the ajax request scope, which will just call the href of the
clicked item (this) as an ajax request in the background, and on
success toggle the state of the element (this) to "active".
Where the class "active" has the star sprite moved in viewing range.
And now, good luck and have fun implementing that. Remember to use
Prototype.
cheers,
Markus
>
> <div id='outer' onmouseout='showOther(0)'
> onmouseover='showOther(-30)' style='position:relative;height:
> 30px;width:30px;overflow:hidden'><div id='inner'
> style='position:absolute;top:0px;left:0px'><img src='sample.gif'></
> div></div>
>
> Then in your showOther function, reposition the inner DIV:
>
> function showOther(pos) {
> $('inner').style.left=pos+'px';
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---