Jump to content
MakeWebGames

Jquery Image Solution Needed


k1ngscorp1o

Recommended Posts

Hey everyone. I'm trying to basically learn how to make a gallery where if you click on the images its selected and stored. The goal is for the user to be able to select a certain amount of images and then when they have selected enough it stores the details in the database. How would I disable selected images once one has been clicked and how would I store these on click and count.

Anyone who has some experience with something similar any help would be appreciated.

Link to comment
Share on other sites

Like this?

(Download)

Few things;

- When displaying images however you see fit, give the image tag a data-id attribute with the value being the images id ( however you want to define the id of an image ),

- The disabled class in the css, is what lowers the opacity ( no hot-fixes, to lazy ).

- store.php is just an example of how to retrieve the data sent by the ajax request, sanitation/validation is up to you, also a storage method is up to you.

- Image state does not default when the max is reached, it's up to you to decide on what happens when the max is reached.

An example.

$('li.disabled').remove(); //Remove current selected.
storedImages = []; //Reset stored images.

Alternative:

window.location.reload();
Edited by Djkanna
Added examples.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...