- This topic has 7 replies, 2 voices, and was last updated 11 years, 7 months ago by
adikate.
-
AuthorPosts
-
adikateMemberis there a way to match two different images with html or javascript. i know how to do similar or identical images but i need to match two unidentical or different images…
for example : if image x, y are nonidentical then i need both of the images to hide…
BrandonMemberCheck out the Resemble js it can do what you need:
http://huddle.github.io/Resemble.js/
adikateMembersorry to say… its just showing the percentage of resemblance. wat i need is by clicking image x,y both images should vanish. if i click only on x or y image should not vanish.
BrandonMemberIm not sure if I understand correctly. So you dont need a script that compares them, you need a script to know if they were both clicked on or not?
adikateMemberyes u r correct. hope u understand what i need to do.. i can give u an example of my project of how its gonna be done
ex: i got so many images with their ids 1,2,… and a,b,… and wat i need is
if i click on image id 1,a both images should vanish and if i click on 1,b it should say with an alert not a correct selection…so matching images id is my main agenda
image id 1 with image id a
image id 2 with image id b
and so on….
BrandonMemberI would use two variables. (untested code, writing out of my head as Im not on my dev system)
var image1int = 0;
var image2int = 0;Then in the click use something like:
//for image 1 first click
if (image1int == 0 )
{
image1int = 1; //replace with the number you want to match
}//image2 first click
if (image2int == 0 )
{
image2int = 1;//replace with the number you wan to match
}//function to check matching
function matchImage()
{
if(image1int == image2int) //image matches
{
//hide both images
$(‘#m1-yourscreen-image1′)css.’visibility’,’hidden’);
$(‘#m1-yourscreen-image2′)css.’visibility’,’hidden’);
}else
{
//images do not match, reset variables
image1int = 0;
image2int = 0;
}
}
adikateMemberSorrry to say that its my mistake to give much details. you misunderstood with what i say..below is brief explaination of what i do
i got so many images with their ids 1.jpg, 2.jpg,… and a.jpg, b.jpg,… and wat i need is
if i click on image id 1.jpg , a.jpg both images should vanish and if i click on 1.jpg , b.jpg it should say with an alert not a correct selection…so matching images id is my main agenda
image id 1.jpg with image id a.jpg
image id 2.jpg with image id b.jpg
image id 3.jpg with image id c.jpg
and so on….Kind regards
adikateMemberSorrry to say that its my mistake to make misunderstood with what i say..below is brief explaination of what i do
i got so many images with their ids 1.jpg, 2.jpg,… and a.jpg, b.jpg,… and wat i need is
if i click on image id 1.jpg , a.jpg both images should vanish and if i click on 1.jpg , b.jpg it should say with an alert not a correct selection…So Matching images id is my main agenda
image id 1.jpg with image id a.jpg
image id 2.jpg with image id b.jpg
image id 3.jpg with image id c.jpg
and so on….Kind regards
-
AuthorPosts