// JavaScript Document $(document).ready(function(){ $('body').append('
'); $('.survey-box').attr('inuse','false'); $('.survey-box').hover(function(){ if($('.survey-box').attr('inuse')!='true'){ $(this).animate({'width':'5px'},200); } },function(){ if($('.survey-box').attr('inuse')!='true'){ $(this).animate({'width':'0px'},200); } }).click(function(){if($('.survey-box').attr('inuse')!='true'){startsurvey()}}); }); function shimmy(){ $('.survey-box').animate({'width':'10px'}).animate({'width':'0px'}); $('.survey-box').animate({'width':'10px'}).animate({'width':'0px'}); $('.survey-box').animate({'width':'10px'}).animate({'width':'0px'}); } function startsurvey(){ $('.survey-box').attr('inuse','true'); $('.survey-box').delay(100).animate({'width':'380px'}); $('.survey-box').append('
Choose a star rating for each aspect:
'); $('.survey-box').append('
Additional Comments:
'); $('.survey-box').append('
Design [Use of color, fonts, logos]
Multimedia [Use of Photos, Videos]
Information [Contact Details, Maps]
Efficiency [Was the text easy to find?]
Updated [Is the content up-to-date?]
'); function surveyinsertstars(aspect){ var text = ''; text += ''; text += ''; text += ''; text += ''; text += '
'; return text; } var surveystars = '
'+surveyinsertstars('design')+surveyinsertstars('multimedia')+surveyinsertstars('information')+surveyinsertstars('efficiency')+surveyinsertstars('updated'); $('.survey-box').append(surveystars); $('.surveyrollover').click(function(){ var surveyaspect = $(this).attr('aspect'); var surveyscore = $(this).attr('score'); $('#survey-'+surveyaspect).attr('score',surveyscore); $('#survey-star-'+surveyaspect).attr('src','survey/survey-star.png').attr('id',''); $(this).attr('src','survey/survey-selected.png').attr('id','survey-star-'+surveyaspect); }); $('.survey-box').append('
'); $('#survey-send-button').click(function(){sendsurvey();}); } function findscore(aspect){ var score = $('#survey-'+aspect).attr('score'); return score; } function sendsurvey(){ var currentip = '216.73.216.145'; var currenturl = 'brooksandson.co.uk'; var datatobesent = 'design='+findscore('design')+'&multimedia='+findscore('multimedia')+'&information='+findscore('information')+'&efficiency='+findscore('efficiency')+'&updated='+findscore('updated')+'&comments='+$('.survey-form').html()+'&url='+currenturl+'&ip='+currentip; $.ajax({ type: 'POST', url: 'http://jumpify.co.uk/survey-receive.php', data: datatobesent, success: function(){ alert('Thanks for your Feedback!'); $('.survey-box').append('Thank you!').html('').animate({'width':'0px'}).fadeOut(); } }); }