Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var current_object;
- var selected_object;
- var onClick= function(){
- selected_object = $(this).attr('src');
- if(selected_object != 'NULL' && current_object == 'NULL' || current_object == undefined){
- current_object = selected_object;
- selected_object = 'NULL';
- }
- else if(selected_object != 'NULL' && current_object != 'NULL' ){
- if (selected_object == current_object)
- {
- $('img').each(function(){
- if($(this).attr('src') == selected_object){
- $(this).remove();
- }
- });
- if (!$('img').is(":visible")) {
- alert("Du klarade det!");
- selected_object= 'NULL';
- current_object= 'NULL';
- }
- else {
- selected_object= 'NULL';
- current_object= 'NULL';
- }
- }
- else{
- alert ("NO! Fel!");
- selected_object= 'NULL';
- current_object= 'NULL';
- }
- }
- };
- $('img').click(onClick);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement