I have this bit of jQuery script that can be found here: http://jsfiddle.net/RUqNN/45/
When I incorporate this script into my wordpress template, I doesn't work.
I've check the jquery source link, rewritten the code, nothing works.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
$(".move").toggle(
function() {
$("#teetimetag").animate({
right: "0px"
}, "normal");
},function() {
$("#teetimetag").animate({
right: "-200px"
}, "normal");
});
});
</script>
<div id="teetimetag">
<img class="move" src="http://test.tooheavytoskydive.com/wp-content/themes/newtheme/images/flag.png" style="float: left;" />
<div style="margin: 15px 0 0 50px;">
<a href="http://test.tooheavytoskydive.com/reservations/" style="color: #FFF; font-weight: bold; font-size: 17px;">Reserve your Tee-Time</a>
</div>
</div>
</body>
</html>
As a general rule, you should not use the
$
variable forjQuery
unless you have used one of the shortcuts. The following is an example of how to shortcut jQuery to safely use the$
variable:To load jquery at wordpress use the either one of the following 2 versions. Include the code at
Plugin Page
OR atfunction.php
Definitely you can use any meaningful function name instead off
include_jQuery
.Alternately, you can use the following code:
You may like THIS link as well from where I personally learn the above technique(s). A Very BIG Thanks to Ericm Martin!
Your website gives the following javascript error: '$ is not a function'. It looks like jQuery conflicts with some other library. This can be solved by calling jQuery.noConflict() and replacing all $ with 'jQuery'. The code will look as follows:
you should register you js files in your template functions.php file:
http://codex.wordpress.org/Function_Reference/wp_register_script