jQuery not working with WordPress
I’m moving a site over to wordpress and cannot get the dot navigation on the right hand side to work (see:
http://s593006646.websitehome.co.uk ). The .js file is below. I believe there is an issue with lines 2-4 but beyond that I've no idea where to turn. Any help is much appreciated!
- jQuery(document).ready(function(){
- jQuery('.awesome-tooltip').tooltip({
- placement: 'left'
- });
- jQuery(window).bind('scroll',function(e){
- dotnavigation();
- });
- function dotnavigation(){
- var numSections = jQuery('section').length;
- jQuery('#dot-nav li a').removeClass('active').parent('li').removeClass('active');
- jQuery('section').each(function(i,item){
- var ele = jQuery(item), nextTop;
- console.log(ele.next().html());
- if (typeof ele.next().offset() != "undefined") {
- nextTop = ele.next().offset().top;
- }
- else {
- nextTop = jQuery(document).height();
- }
- if (ele.offset() !== null) {
- thisTop = ele.offset().top - ((nextTop - ele.offset().top) / numSections);
- }
- else {
- thisTop = 0;
- }
- var docTop = jQuery(document).scrollTop();
- if(docTop >= thisTop && (docTop < nextTop)){
- jQuery('#dot-nav li').eq(i).addClass('active');
- }
- });
- }
- /* get clicks working */
- jQuery('#dot-nav li').click(function(){
- var id = jQuery(this).find('a').attr("href"),
- posi,
- ele,
- padding = 0;
- ele = jQuery(id);
- posi = (jQuery(ele).offset()||0).top - padding;
- jQuery('html, body').animate({scrollTop:posi}, 'slow');
- return false;
- });
- /* end dot nav */
- });