Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-08-2009, 08:37 PM   PM User | #1
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
outlines on elements

Hi all, iv'e been trying to get round this for 2 days and still nothing.

What i want to do is to be able to outline elements on a page when hovered over... simple you might think. which it is.

Then with the id of the item outlined when right clicked, and chose an option, other things happen.

The menu side is sorted, and the hover outline is sorted. But iv'e been trying to put them both together but it wont work!

This is the closest iv'e gotten, whcih runs sooooo slow.

Code:
$(document).ready(function() {
		function elementHover(){
			$("*").bind("mouseover", function(event) {
				var element = $(event.target);
				if($(element).attr("rel")!="rightClickMenu"){
					$(element).addClass('outline-element');
					if( ($(element).attr("id")!="") && (typeof $(element).attr("id") != "undefined") ){
						getElementObj($(element));
						$("[id!='" + $(element).attr("id") + "']").hover(function(){
							$("#" + $(element).attr("id")).removeClass('outline-element');
						});
					}else{
						return "";
					}
				}else{
					return "";
				}
			});
		}
		elementHover();
    });
the big problem being this
var element = $(event.target);
if i changed it to
var element = $(event.target);
alert($(element).attr("id"));


it would open the dialog box about 10 times spitting all kinds of results. Any help would be much appreciated.
__________________
Website Design Mansfield
PHP Code:
function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
echo 
I_LOVE(); 
Phil Jackson is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:56 PM.


Advertisement
Log in to turn off these ads.