Making a function dynamic
Hi There!
Fairly new to jquery but learning at a rate of knots..
I have a wordpress blog where each post on a page has a 'share' menu that uses fadeIn and fadeOut. The problem is when I load the page, my code isn't dynamic so every instance on the page has the same name, and every instance fades in and out at the same time..
$(document).ready(function() {
$('#share-10 .shareme').click(function() {
$('#share-10 .shareto').fadeIn('fast', function(){
setTimeout(function(){
$('#share-10 .shareto').fadeOut('fast');
}, 7500 );
});
});
});
As you can see, I'm using wordpress' functionality to add an ID in front of each of my 'share' divs, but how do I add a dynamic element to my script to ensure that if the ID is #share-7 (for example) then only the relevant posts 'share' div fades in?
Any help greatly appreciated!
Toby