In this step, we will add some functionality into the Check results button. This is implemented by adding the jQuery JavaScript library into the HTML page, and using its methods to manipulate and animate the HTML page so that the results are shown when the button is pressed.
The minified version of the jQuery Library, which is needed in this step, is available in the html directory of the project. A small tweak has been made into the file: by default, the animation functionality has been implemented in jQuery with timer intervals having a constant 13 millisecond delay. We have changed the delay to 50, which allows also mobile devices to render the page fully before the next animation frame without affecting the animation noticeably. This was done by replacing the setInterval(c.fx.tick,13) string with setInterval(c.fx.tick,50) in the jQuery file.
Edit the resource file pluginexample.qrc and add the html/jquery-1.4.2.js file as was done with the other files of the HTML page in Step 2.
Always remember to also add the new HTML source files into the resource file, when adding them into your project.
Include the jQuery library file in the head section of the HTML page before including the html/javascript.js file by modifying the head section of the html/index.html file as follows:
Edit the end of the html/javascript.js file so that the required code is added for the lines starting with the line '@TODO STEP 7.3 STARTS' and ending with the line '@TODO STEP 7.3 ENDS', according to the code comments between these lines.
The resulting lines should look as follows. The documentation for the jQuery API used here can be found on the http://docs.jquery.com site. The $(document).ready() function is documented here.
When you build and run the application, you will see that when the Check results! button is clicked, result boxes are shown with a sliding down animation. If the application is not working properly, download and use the files in this zip file.