Thanks Eric!
To be clear, when you guys talk about Prototype, you are talking about the "prototype.js" that comes with script.aculo.us? Also, so I would add this:

visible: function(element) {
     return $(element).getStyle('display') != 'none';
  }

to the Element.addMethods function in the prototype.js file? How exactly would I implement this in the html file? As I have it right now, the container div is hidden in HTML level css, not through a css class ("style="display: none;""). Where would I put this:

if ( ! $(element).visible() ) {
     $(element).toggle();
  }

??

Sorry for all the questions, but I'm learning as I go. Thanks!

james



On Dec 28, 2006, at 3:39 AM, Eric Harrison wrote:


You could try this:

code:

  if ( ! $(element).visible() ) {
     $(element).toggle();
  }

One thing you might need to consider (in case you're like me and
you're using classes to set the initial display style attribute) is
that Prototype's Element.Methods.visible() function manually checks
the .style.display attribute which isn't set if you're setting the
initial display attribute in a CSS class.

I had to fork my Prototype code like this:

Element.addMethods({
  visible: function(element) {
     return $(element).getStyle('display') != 'none';
  }
});

That will check the computedStyle of that element and will work in most cases.

Let us know if this helps,

-E

On 12/27/06, James Song <[EMAIL PROTECTED]> wrote:

Hi guys,
i'm relatively new to ajax, and I've built the following site:

http://www.bluntside.com/v.x3/index2.html

with the help of xilinus and his prototype carousel script. So right
now the way it works is I have 2 carousels with x number of
thumbnails in them. Each thumnail is a link to an external content
page. Right now I have each thumbnail linking to the Effect.toggle
function that toggles a container div under the carousel. The problem
is that since it's a toggle, after you've expanded the div with a
first click, if you click on another thumbnail it will collapse the
div. Can anyone suggest a way to check and see if the container is
visible or not and then either load the content into the container or
close the container? Any help is appreciated. Thanks

james

>



--
Eric Ryan Harrison

>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to