[Pro] Hide show on hover

I’m working on a site for a healthclub using FW and EE. One page is defined as an introduction page of the employees. The page has 2 columns. In the right column all the photo of the employees are listed. I want to show the bio (text) in the left column for that specific person while hovering over it’s photo.

I’m puzzling on this already for a while and can’t find a working solution. There are 2 challenges: showing content on another part of the page while hovering and displaying the bio that belongs to the photo your hovering over.

The page can be viewed here: http://www.thewavealmere.eu/about_us/onze_medewerkers/

My html looks like this:

					{/bio_gallery}
				</div>
			</aside>
			<section class="span-16 last">
				<div class="main-content">
					<article id="side-content">
						<hgroup>
							<h1>{title}</h1>
							<h2>{bio_subtitel}</h2>
						</hgroup>
						<p>{bio_body}</p>
					</article>
					<ul id="biografie">
						{bio_gallery}
						<li ><a href="#" {exp:imgsizer:size src="{image}" width="80" height="100"}>
						<img class="smallpolaroid" src="{sized}" alt="{image_alt}"/>
						{/exp:imgsizer:size}
						</a><span><h5>{image_firstname}</h5></span></li>
						{/bio_gallery}
					</ul>
				</div>
				{/exp:weblog:entries}
			</section>

freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

First, what’s the link to # doing on the employee photo? Are you
trying to use that to trigger your bio appearing? Second, is this the
structure that all of your bio/photo groups will have? If so, you can
use Prototype to do this. You’ll need to get a handle on each of the
bios and each of the photos. It would be simplest if you could apply a
classname to each, so there would be <article id="side-content" class="bio_text"> ... </article> and <img class="smallpolaroid bio_photo" src="{sized}" alt="{image_alt}"/> repeated once for each
person. Then, to gather each of your elements, and to hide your bio
text, you would do something like this:

var texts = $$('.bio_text').invoke('hide');
var photos = $$('.bio_photo');

Now you have two Arrays of the same length containing the elements you
need to work with, and so the rest is pretty simple. You walk through
the array of photos, setting each member up to respond to a mouseenter
event by showing its apposite bio text:

photos.each(function(elm, idx){
	var idx = idx;
	elm.observe('mouseenter',function(evt){ texts[idx].show(); });
	elm.observe('mouseleave'),function(evt){ texts.invoke('hide'); });
});

This script relies on you always having the same number of bios and
photos, because that’s how it keeps track of which photo refers to
which bio. This also means you should never use those marker
classnames for anything else on your page (so don’t use them to carry
styling information, because Freeway loves to use that over again, and
that will break this solution).

That should get you started. All the JavaScript code above needs to be
added to the bottom of your HTML code, just before the /body tag, in a
script block; and in the head of your page, you need to include the
link to prototype.js. I like to use Googles CDN for this:

<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6/prototype.js 
"
	type="text/javascript">
</script>

Walter

On Aug 25, 2010, at 4:05 AM, RobP wrote:

I’m working on a site for a healthclub using FW and EE. One page is
defined as an introduction page of the employees. The page has 2
columns. In the right column all the photo of the employees are
listed. I want to show the bio (text) in the left column for that
specific person while hovering over it’s photo.

I’m puzzling on this already for a while and can’t find a working
solution. There are 2 challenges: showing content on another part of
the page while hovering and displaying the bio that belongs to the
photo your hovering over.

The page can be viewed here: http://www.thewavealmere.eu/about_us/onze_medewerkers/

My html looks like this:

  				{/bio_gallery}
  			</div>
  		</aside>
  		<section class="span-16 last">
  			<div class="main-content">
  				<article id="side-content">
  					<hgroup>
  						<h1>{title}</h1>
  						<h2>{bio_subtitel}</h2>
  					</hgroup>
  					<p>{bio_body}</p>
  				</article>
  				<ul id="biografie">
  					{bio_gallery}
  					<li ><a href="#" {exp:imgsizer:size src="{image}" width="80"  

height=“100”}>
{image_alt}
{/exp:imgsizer:size}

{image_firstname}

{/bio_gallery}


{/exp:weblog:entries}


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hoi Walter,

Check the website http://www.someoneels.nl and hover over the small images. That makes the big image show the specific image belonging to the small one. If this is what you mean than this can be done quite easy in Freeway Pro.

Groeten,
Bart | www.dtp2.nl


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walt,

Thanks for the reply, this should get my started. And yes, the # was my simple try to trigger the photos…

The one issue I see in your solution is adding the class names to the individual photo’s and bio’s. Both photo’s and bio’s and also the employee names are pulled out of the Expression Engine weblog.

Rob


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Well, then you can just put them in the template for your loop. What
are you using to create those? If Freeway, then you can just crack
open the item with the Item / Extended dialog, add a new entry for
‘class’ and a new value for the appropriate classname. Since it’s a
template, you only have to do this once per item type. EE will fill in
all the rest when it spins through the record set.

Walter

On Aug 26, 2010, at 2:49 AM, RobP wrote:

Hi Walt,

Thanks for the reply, this should get my started. And yes, the # was
my simple try to trigger the photos…

The one issue I see in your solution is adding the class names to
the individual photo’s and bio’s. Both photo’s and bio’s and also
the employee names are pulled out of the Expression Engine weblog.

Rob


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walt,

Only using FW in the first stage of development, then continuing using CODA.

I started building using your suggestions. Disabled JQuery on that page, loaded Prototype, added the classes and the first part of the script hiding the text.
So far so good, the text is hidden.

					<ul id="biografie">
						{bio_gallery}
						<li {exp:imgsizer:size src="{image}" width="80" height="100"}/>
						<img class="smallpolaroid bio_photo" src="{sized}" alt="{image_alt}"/>
						{/exp:imgsizer:size}
						</a><span><h5>{image_firstname}</h5></span></li>
						{/bio_gallery}
					</ul>
					<script>
					var texts = $$('.bio_text').invoke('hide');
					var photos = $$('.bio_photo');
					</script>

Now I added the second part of your script to the DIV where the bio-text is supposed to show, like this

					<p class="aside bio_text">{image_bio}</p>
					<p class="handtekening">{image_firstname}</p>
					<script>
					photos.each(function(elm, idx){
					var idx = idx;
					elm.observe('mouseenter',function(evt){ texts[idx].show(); });
					elm.observe('mouseleave'),function(evt){ texts.invoke('hide'); });
					});
					</script>

I’m a rookie working with scripts so I might have done something wrong there cause the text is not showing while hovering the related bio_photo.
Any suggestions?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Can you post a link to the page as rendered through EE? I can’t really
tell from here what might be going wrong.

Walter

On Sep 7, 2010, at 4:18 AM, RobP wrote:

Hi Walt,

Only using FW in the first stage of development, then continuing
using CODA.

I started building using your suggestions. Disabled JQuery on that
page, loaded Prototype, added the classes and the first part of the
script hiding the text.
So far so good, the text is hidden.

  				<ul id="biografie">
  					{bio_gallery}
  					<li {exp:imgsizer:size src="{image}" width="80" height="100"}/>
  					<img class="smallpolaroid bio_photo" src="{sized}"  

alt=“{image_alt}”/>
{/exp:imgsizer:size}

{image_firstname}

{/bio_gallery}


Now I added the second part of your script to the DIV where the bio-
text is supposed to show, like this

  				<p class="aside bio_text">{image_bio}</p>
  				<p class="handtekening">{image_firstname}</p>
  				<script>
  				photos.each(function(elm, idx){
  				var idx = idx;
  				elm.observe('mouseenter',function(evt){ texts[idx].show(); });
  				elm.observe('mouseleave'),function(evt) 

{ texts.invoke(‘hide’); });
});

I’m a rookie working with scripts so I might have done something
wrong there cause the text is not showing while hovering the related
bio_photo.
Any suggestions?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walt,

Here is the link to the page: http://www.thewavealmere.eu/about_us/onze_medewerkers/


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Should be a simple fix. It looks like a typo in the rendered code:

elm.observe('mouseleave'),function ...

should be:

elm.observe('mouseleave',function ...

Just take out that extra close-parenthesis and you’ll be all set.

Walter

On Sep 7, 2010, at 5:11 AM, RobP wrote:

Walt,

Here is the link to the page: http://www.thewavealmere.eu/about_us/onze_medewerkers/


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Changed it but unfortunately nada, nothing happens on hover.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The error has moved. Now it can’t find the reference to the variable
photos. You’re calling it at line 249, but you don’t create it until
line 407. You can move all of this code together into one block,
starting at line 407 where you create the two arrays, then followed by
the photos.each stuff from line 249. You will only need one script
block to do this.

Walter

On Sep 7, 2010, at 5:55 AM, RobP wrote:

Changed it but unfortunately nada, nothing happens on hover.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Great Walt.

Works exactly as I originally intended.
Thanks for the support again! learning makes perfect.

Rob


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options