SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JQuery with Image Map Areas

    I am trying to match a passed parameter on a url to an area on an image map.

    So far I can find the correct area using

    Code:
              $('#mediummap area').each(function(i){
    href = $(this).attr('href');
    if (href == id) {
        alert('Found ID ' + id);
        }
     });
     }
    });
    But next I need to retrieve the co-ordinates for the Area

    I have tried
    Code:
        coords = $('this').attr('coords');
    and
    Code:
        coords = $('this').coords();
    but must be missing something silly as I can not seem to get the value back, just an undefined return.

    What I want to do is to find the point on the image map and then centre that point with in the viewport for the image (large image, small viewport).

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Location
    Kingdom of Saudi Arabia
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    //"id" is from?
    $('#mediummap area').each(function(i){
    	var href	= $(this).attr('href'),
    		coords	= $(this).attr('coords');
    	if (href == id) {
    		alert('Found ID ' + id);
    		alert('Coords is '+ coords);
    	}
    });


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •