Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem using text as a link for an expanding div.

 
Ryan Christiani
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on a site for a job, wordpress site.

They want "..." to activate a expanding div with more info in it, code like such.



The ellipsis

The div that expands.



Problem is the "..." does not activate the script, does this have something to do with text as the element that has to be clicked? or have I just made some werid mistake?

Thanks
 
Ryan Christiani
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I solved it, sort of, but this just brings up some more questions.


I moved my span into the container that has the expanding div in it. In a case like this does the element to activate the script have to be right before the element that will be activated? Does that make sense, how can I have a link that toggles from another location?

Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FYI that span is not keyboard accessible. I would have to use a mouse, not the best design. [aka use a link]

Why the original one failed

Description: Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.


detail is not a sibling.

With your adjusted code, you can call the code from anywhere with just:



You should also look at using document.ready instead of onload to attach the events.

Eric
 
Ryan Christiani
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info, link makes more sense, wasn't aware spans were not keyboard accessible.

I originally had it as,



but it would not load the script for some reason, from the net panel in firebug the page did fully load.

In terms of the detail sibling. So say I have this.



How would I go about setting that to expand. I am a little confused on that works, I have tried it and it did not seem to work out.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way would be



Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic