$(document).ready(function() { /* * You'll need your own API key, don't abuse mine please! * Get yours here: http://www.websnapr.com/free_services/ */ //var apiKey = 'kx7kJG6cuzoJ'; // Notice the use of the each method to gain access to each element individually $('#content a.qtipright').each(function() { // Grab the URL from our link var url = encodeURIComponent( $(this).attr('href') ).replace('http%3A', '').replace('https%3A', '').replace(/%2F/g, '').replace(/%26/g, '').replace(/%5C/g, '').replace(/%3D/g, '').replace(/%3F/g, '').replace(/district/g, '').replace(/www./g, '').replace(/.pdf/g, '').replace(/.cfm/g, '').replace(/gstboces.orgmsfoodservicesnewsite/g, '').replace(/uploadeddocs/g, ''), // Create image thumbnail using Websnapr thumbnail service thumbnail = $('', { //src: 'http://images.websnapr.com/?url=' + url + '&key=' + apiKey + '&hash=' + encodeURIComponent(websnapr_hash), src: 'thumbs/' + url + '.jpg', alt: 'Loading thumbnail...' + url, width: 202, height: 152 }); //alert(url); // Setup the tooltip with the content $(this).qtip( { content: thumbnail, position: { my: 'left bottom', at: 'right bottom' //viewport: $(window) // Attempt to keep it on screen at all times }, style: { classes: 'ui-tooltip-thumbnail ui-tooltip-shadow' } }); }); });