[Pro] Mouse Evnt /roll over

Yup, it’s you. You’ve got to get these images organized in such a way
that you can call them by name and not have any confusion.

Start by getting rid of everything else on the page except the three
normal buttons and the three over buttons. Make sure that all of them
are layered objects, with the Layer checkbox checked in the Inspector.
Then click on the word Site at the top of the left pane, so it
switches over to Page. You should see the page name, with six image
names underneath that. Drag them up and down in the list so that you
see this:

index.html
	about
	aboutOver
	market
	marketOver
	outdoor
	outdoorOver

Rename the images by option-clicking on each name in the list and
typing in the desired name.

Now, while nothing on the page is selected (click somewhere blank on
the page) open the Actions palette, and click on the Protaculous tab
and the top Function Body button. There, you’ll see $(‘over’).hide();

Ask yourself, “what on this page is named ‘over’?” And extra points if
you say, “Nothing!”

At this point, you can do one of two things (but not both):

$w('aboutOver marketOver outdoorOver').each(function(name){
	$(name).hide();
});

or

$('aboutOver').hide();
$('marketOver').hide();
$('outdoorOver').hide();

Now your over images will hide properly when the page loads.

Next, you need to go through all of the Observer Actions (applied to
the about, market, and outdoor images) and make sure that the name of
the “Over” version is corrected so they read

$('aboutOver').appear();

or the like, as appropriate for their specific “partner” image, and
also that the “over” images all have the correct names as well:

$('aboutOver').fade();

But if you’ve come this far (and gotten this close) you might want to
know how to make this work in one function applied in Protaculous,
rather than Protaculous AND two instances of Observer for each
animation.

So you’ve gone through and renamed your images as described above. Now
click on each one in the list in the left pane, and in the Actions
palette, click the little (x) in the tab where it reads Observer. The
little cog icon should disappear from each of the six image names.

Now click on the page somewhere blank, and open up the Function Body
editor in Protaculous. Paste in this:

$w('about market outdoor').each(function(name){
	var name = name;
	$(name + 'Over').hide().
		observe('mouseout',function(evt){
			this.fade();
		});
	$(name).observe('mouseover',function(evt){
		$(name + 'Over').appear();
	});
});

Preview, and see how it works.

What it’s done, line by line, is this:

  1. Set up an array of three words, and pass that to an iterator[1]
    named each
  2. Inside the each method, let the variable name stand for the current
    word
  3. Use the Prototype shortcut for document.findElementById() ($) to
    find an element on the page with the ID
    [whateverNameIsCurrentlyEqualTo] + ‘Over’, and hide it.
  4. Using that same handle again, start an observer on the mouseout
    event.
  5. When a mouseout occurs, fade the element that triggered that event.
  6. Close the observer
  7. Find an element on the page with the ID
    [whateverNameIsCurrentlyEqualTo] and set an observer on the mouseout
    event.
  8. When that event happens, cause the
    [whateverNameIsCurrentlyEqualTo] + ‘Over’ element to re-appear.
  9. Close listener.
  10. Close iterator.

So the trade-off is that you have to name everything correctly. But
wait, that’s not such a trade-off because you have to do that anyway.

Walter

  1. An iterator is a kind of function that will loop over a collection
    of elements, yielding the current element to itself for further
    processing. If you’ve done any traditional JavaScript programming, you
    might recognize this construct:

    for(i=0; i < something.length; i++){
    alert(something[i]);
    }

An iterator is that, but with rocket boosters and inline skates, and
maybe ninjas.

On May 23, 2011, at 7:36 PM, stuart wrote:

Walter Hi thanks …its beginning …

the only issue i have is when it loads http://www.web.nonfacture.co.uk/index.html
the images dont load correctly …is that me

Stu


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

Walter

Sorry to bother you again
One thing I was wondering is that java

$(‘outdoorOver’).hide();

$(‘aboutOver’).appear();
You helped me with very kindly the only i see is the loading
i have the main nav working but it never seems to load after that

i.e on the PORTFOLIO page
(i have only done the x2 (top row 2nd in and last right top row) again
but I seem to have the issue of loading any thought why

http://www.web.nonfacture.co.uk/


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

I’m not sure what your question is here. I can roll over those two
elements in the portfolio section of the page, and the load and unload
when I mouse out. They don’t do anything when clicked, but I’m not
sure you’ve set them to do anything yet. The page appears complete
here, no missing images, or missing rollovers from what I can see.

What are you expecting to happen, and what isn’t happening? Perhaps
you have a cache issue there, you might try navigating to a different
page, clearing your cache (Safari / Clear Cache) and the go back to
that page so it’s forced to load again.

Walter

On Jun 19, 2011, at 4:58 PM, stuart wrote:

Walter

Sorry to bother you again
One thing I was wondering is that java

$(‘outdoorOver’).hide();

$(‘aboutOver’).appear();
You helped me with very kindly the only i see is the loading
i have the main nav working but it never seems to load after that

i.e on the PORTFOLIO page
(i have only done the x2 (top row 2nd in and last right top row) again
but I seem to have the issue of loading any thought why

http://www.web.nonfacture.co.uk/


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

What I am seeing is the 2 (Godiva and City Tourism) being in the Over state on Page Load.

If you look at the following

document.observe('dom:loaded',function(){
$('Normal14').observe('mouseover', function(evt){
$('awaOver').appear({duration:0.3});
});
});
document.observe('dom:loaded',function(){
$('cdo').observe('mouseover', function(evt){
$('cdoOver').appear({duration:0.3});
});
});
document.observe('dom:loaded',function(){
$('awaOver').observe('mouseout', function(evt){
$('awaOver').fade({duration:0.3});
});
});
document.observe('dom:loaded',function(){
$('cdoOver').observe('mouseout', function(evt){
$('cdoOver').fade({duration:0.3});
});
});

You will see that different elements are defined in the the first 2 ie Normal14 & awaOver and cdo and cdoOver

Whereas in the second 2 the elements are the same ie awaOver & awaOver and cdoOver and cdoOver

So apart from the fact that you have some duplication of observers, you also have element duplication.

So go and check your IDs/image names

David


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

David
Thanks
Sorted all that out
Still have the issue of the carousel

Stu


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

Still have the issue of the carousel

You will have to remind us about that

D


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

OK - I see your other thread on that one.

D


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

Thanks dealing with it Both of you have been stars thanks carousel working but just sorting out dup of code

builder,builder,builder
very odd

but that carousel … The light just come on loads and how to use that as a hide and show graphical item …
Show and Hide… idea

Its great function

Its slow process learning but all good


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