WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Site Design > Graphics & Design Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-20-2006, 01:21 PM
WebProWorld Member
 

Join Date: Jan 2004
Location: Lancaster, PA USA
Posts: 30
beka RepRank 0
Default hover effect not working on one page - fine on re st. .

Hi,

the butterfly is supposed to have a simple hoverover effect like on this page: (scroll to bottom)

www.papillonfaceplace.com/organic.html

(it's a 'back to top' button)

it works fine on every page but the below...cannot figure out why...

www.papillonfaceplace.com/cskinc.html

scroll down just a tad.....

client wondering as well......

ASAP would be swell!

Thanks so much!!

Beka
Reply With Quote
  #2 (permalink)  
Old 09-20-2006, 02:41 PM
dharrison's Avatar
Moderator
WebProWorld Moderator
 

Join Date: May 2005
Location: Essex, UK
Posts: 1,424
dharrison RepRank 3dharrison RepRank 3
Default

Hi Beka

Nice site! Very calming.

I personally can't see anything wrong with your JavaScript code. As it serves the same function on both pages have you tried saving the JavaScript that works into an external file (with extension .js) and calling it up, for example:

<script type="text/javascript" src="hover.js"></script>

That would also save you a few lines on each page as well which is always good news.

HTH
__________________
Deb Harrison
DVH Design
Essex Web Design | Web Design Blog
Reply With Quote
  #3 (permalink)  
Old 09-20-2006, 03:54 PM
WebProWorld Member
 

Join Date: Feb 2005
Location: United States
Posts: 111
wsmeyer RepRank 0
Default

The JavaScript is breaking on the second occurence of

Code:
<img name="butterfly2_01"
If you want to use it more than once on a page they each need a unique name.

William.
Reply With Quote
  #4 (permalink)  
Old 09-20-2006, 04:39 PM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

Hello,
Might I suggest...

Cut all the JS out of your head section.
Add this to your CSS.

.toplink a{width: 89px; height: 75px; background: url("images/butterfly2_01.jpg") no-repeat 100% 100%;; border: none; text-decoration: none;}
.toplink a:hover{width: 89px; height: 75px; background: url("images/butterfly2_01-over.jpg") no-repeat 100% 100%;; border: none; text-decoration: none;}

Change all link coding within page to this...
<div class="toplink"></div>

This is going to save tons of page code and work multiple times on the page.
Speaking of which, change the id="maintext" to a class tag as id's should only be used once per page. Make the change in CSS as well.
Also look for three extra </h4> tags you have and remove them.

Hope that helps.
Drummin
Reply With Quote
  #5 (permalink)  
Old 09-21-2006, 09:50 AM
WebProWorld Member
 

Join Date: Jan 2004
Location: Lancaster, PA USA
Posts: 30
beka RepRank 0
Default

Thank you all so much!

will have to try what y'all have suggested..i like the idea of putting all the js in an external css file...

if i can't quite get it, i'll be back!!

Thanks again!
Reply With Quote
  #6 (permalink)  
Old 09-21-2006, 11:03 AM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

Hi Beka,
I didn't say to put js in css file. That would not be good.
What I suggested was making the hover with CSS instead of js. So your removing all the js. Then add the CSS lines I showed to your CSS file.
Then replace the bulky code containing the link to the top with the div class line.
Understand?

Hope so.
Let me know...
Drummin
Reply With Quote
  #7 (permalink)  
Old 09-21-2006, 03:27 PM
WebProWorld Member
 

Join Date: Jan 2004
Location: Lancaster, PA USA
Posts: 30
beka RepRank 0
Default

Thanks Drummmn..i understand...well, i have done all that you suggested, but the little butterfly is not showing up....i'm sure i did exactly what you wrote...have not uploaded page yet...
Reply With Quote
  #8 (permalink)  
Old 09-21-2006, 03:36 PM
WebProWorld Member
 

Join Date: Jan 2004
Location: Lancaster, PA USA
Posts: 30
beka RepRank 0
Default

Quote:
Speaking of which, change the id="maintext" to a class tag as id's should only be used once per page.
I'm a basic css user so am not clear on what you're suggesting and saying here...when i made the 'maintext' rule it was with the selector "class" chosen, so i guess i thought it was a class? the rule is actually not doing what i wanted it to do though....

thank you....

hope this all made sense...

Code:
.maintext {
	padding-left: 50px;
	padding-top: 20px;
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: 12px;
	padding-right: 25px;
}
Reply With Quote
  #9 (permalink)  
Old 09-21-2006, 05:23 PM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

Without seeing what you've done it's had to say what is going on.
Check pathway to images.
If images are in a folder be sure to add image folder name. If CSS is in a folder you need to "back out" of the folder.
For example:
../images/YourImageName.gif

As far as the maintext issue... the css shown in your last post looks fine. To call on this class in you pages you need to use the word "class" instead of id as in <span class="maintext">

If you still need help let us know. :)
Drummin
Reply With Quote
  #10 (permalink)  
Old 09-21-2006, 05:27 PM
WebProWorld Member
 

Join Date: Feb 2005
Location: United States
Posts: 111
wsmeyer RepRank 0
Default

There is an extra ; in the code provided by drummin:

Code:
.toplink a{width: 89px; height: 75px; background: url("images/butterfly2_01.jpg") no-repeat 100% 100%;; border: none; text-decoration: none;}
.toplink a:hover{width: 89px; height: 75px; background: url("images/butterfly2_01-over.jpg") no-repeat 100% 100%;; border: none; text-decoration: none;}
It is a bit of extra work at this point but it really would be worth the effort to convert it all to CSS.

William.

[edit] I tried to color it red but it didn't work out to well :( Just look in the code for ;; and delete one.
Reply With Quote
  #11 (permalink)  
Old 09-21-2006, 05:30 PM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

Noticed that ";" after posting... Won't affect funtion.
Reply With Quote
  #12 (permalink)  
Old 09-21-2006, 07:52 PM
WebProWorld Member
 

Join Date: Jan 2004
Location: Lancaster, PA USA
Posts: 30
beka RepRank 0
Default

here's a new page with the js removed and the the css added...i only tried it on the one butterfly above the blue animated text "the new wave".

www.papillonfaceplace.com/cskinc2.html

it's not showing up at all...the image path and all else looks fine to me.......i'm sure i missing something very simple....

thanks for all your expertise!!
Reply With Quote
  #13 (permalink)  
Old 09-21-2006, 11:18 PM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

Hi Beka,
Not seeing the toplink class in your pap.css file.
Needs to be there for this to work.
Try reloading css file.
Reply With Quote
  #14 (permalink)  
Old 09-21-2006, 11:20 PM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

Ya...
I just added the css code to the pap.css copy I have and it works fine.
Still got an extra </h4> on line 153. :)

By the way, the css in page can be added to pap.css file as well.
Reply With Quote
  #15 (permalink)  
Old 09-21-2006, 11:28 PM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

And as William pointed out, remove extra ; I had in css. My bad.

.toplink a{width: 89px; height: 75px; background: url("images/butterfly2_01.jpg") no-repeat 100% 100%; border: none; text-decoration: none;}
.toplink a:hover{width: 89px; height: 75px; background: url("images/butterfly2_01-over.jpg") no-repeat 100% 100%; border: none; text-decoration: none;}
Reply With Quote
  #16 (permalink)  
Old 09-22-2006, 06:18 AM
WebProWorld Member
 

Join Date: Jan 2004
Location: Lancaster, PA USA
Posts: 30
beka RepRank 0
Default

here she be - updated with all css on the pap.css page, no more js for these butterfly instances, removed the extra </h4> (thanks!) reloaded everything and nada....

www.papillonfaceplace.com/cskinc2.html

not sure why still no go...
Reply With Quote
  #17 (permalink)  
Old 09-22-2006, 06:33 AM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Cornwall, UK
Posts: 833
speed RepRank 1
Default

In the CSS you have:

toplink a{

it should be:

.toplink a{

Note the leading dot.

Also you will need to add display: block; to .toplink a so you end up with:

.toplink a{
display: block;
width: 89px;
height: 75px;
border: none;
text-decoration: none;
background-image: url(images/butterfly2_01.jpg);
background-repeat: no-repeat;
background-position: 100% 100%;
}
__________________
TOLRA Micro Systems Limited US & UK Web Hosting with Continuous Data Protection
Web Directory 2 for 1 Offer : Web Directory Script
Reply With Quote
  #18 (permalink)  
Old 09-22-2006, 11:56 AM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

Hi Beka,
Glad you got this working!!!

Hey Speed,
Is block really needed in this case as they're using two images? The only time I add block is when I'm using a button-set image containing several buttons. Your knowledge of CSS in well respected. Can you clarify for me?

By the way, 100% 100% was for the repeat property and not backgroud-position. I suppose because we have no-repeat it should say 0 0; instead.
Thanks,
Drummin
Reply With Quote
  #19 (permalink)  
Old 09-22-2006, 12:12 PM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Cornwall, UK
Posts: 833
speed RepRank 1
Default

Hi drummin,

In the HTML it has:
Code:
<div class="toplink"></div>
The CSS has:
Code:
.toplink a{
    display: block; 
	width: 89px;
	height: 75px;
	border: none;
	text-decoration: none;
	background-image: url(images/butterfly2_01.jpg);
	background-repeat: no-repeat;
	background-position: 100% 100%;
} 

.toplink a:hover{
	width: 89px;
	height: 75px;
	border: none;
	text-decoration: none;
	background-image: url(images/butterfly2_01-over.jpg);
	background-repeat: no-repeat;
	background-position: 100% 100%;
}
Although the <div> is a block element the <a> tag is an inline element and it is this that is given width, height and the background image.

However as the <a> tag is inline it will not respect the dimensions, well not in Firefox any way, therefore you need to force the tag to be block so that it picks up the dimensions. You could also wrap the <a> tag around an image or other element which would achieve roughly the same.
__________________
TOLRA Micro Systems Limited US & UK Web Hosting with Continuous Data Protection
Web Directory 2 for 1 Offer : Web Directory Script
Reply With Quote
  #20 (permalink)  
Old 09-22-2006, 12:19 PM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: California,USA
Posts: 373
drummin RepRank 0
Default

Thanks Speed!
Learning all the time...
Reply With Quote
  #21 (permalink)  
Old 09-22-2006, 12:55 PM
WebProWorld Member
 

Join Date: Jan 2004
Location: Lancaster, PA USA
Posts: 30
beka RepRank 0
Default

Yahooooooooooooo!

thank you so much drummin and speed!!

happiness...now i can get paid..!

css is so layered...i need to learn more than the basics...

really appreceiate your help in solving the issue that is thankfully no more!
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum
Tags: , , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0