www.webdeveloper.com
Results 1 to 2 of 2

Thread: Matching different images

Hybrid View

  1. #1
    Join Date
    Jul 2013
    Posts
    12

    Matching different images

    hi, i am trying to match images. this one works fine only with same images but i want to match unidentical images based on their id or src

    below is the working code for similar images

    http://jsfiddle.net/GquLr/

    can u help me the code with different images based on the image id or src. i am trying to do but i cant get it. plz help me with...


    regards
    kadi

  2. #2
    Join Date
    Jun 2008
    Posts
    106
    This should be easy. Just remove your code on lines 9-11. Then we check if the id's first character is the same as the last image clicked id's first character.

    Since you made the first IDs 1a, 2a, and 3a, and the second IDs 1b, 2b, and 3b, it's easy to detect when they are the same.
    1a will be the same as 1b, if you designed the html correctly (which you didn't, somewhat).

    Here is the small change I made: http://jsfiddle.net/thetenfold/kRz59/
    To demonstrate the change, you can change the 1b image's src to anything you want, but it will always match up with 1a (and even 1c, 1d, etc).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles