k1ngscorp1o Posted August 10, 2013 Posted August 10, 2013 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. Quote
Djkanna Posted August 10, 2013 Posted August 10, 2013 (edited) 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 August 10, 2013 by Djkanna Added examples. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.