Hi I am trying to have a floating div block. For that i Have done following: In header.php (using a custom jQuery function): $(document).ready(function() { $(window).scroll(function() { $('#globalnav').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350}); }); $('#close_message').click(function() { //the messagebox gets scrool down with top property and gets hidden with zero opacity $('#globalnav').animate({ top:"+=15px",opacity:0 }, "slow"); }); }); Code (markup): Issue: This works perfectly on the landing page of the blog but on the individual post page the same thing doesn't work. It shows me the globalnav menu but it neither scrolls nor closes. Is the javascript not reloading or what..?? TIA
how did you load the jquery in wordpress? if you used wp_enqueue_script then use this syntax jQuery.noConflict(); jQuery(document).ready(function($){ // Now you can use $ here }); Code (markup): I will preffer to use wp_enqueue script so if there is any other plugin or wordpress itself is loading jquery there will be no confliction in this way..;
hey thanks for the reply but i have a couple of doubts: I am using WPESP theme which loads jquery and the designer is loading it like <script src="<?php bloginfo('template_url'); ?>/style/scripts/jquery-1.2.6.min.js" type="text/javascript" charset="utf-8"></script> Code (markup): Now if I load it using wp_enque_script & comment out previous statement his jquery functionality is not working which is defined in other js files <script src="<?php bloginfo('template_url'); ?>/style/scripts/jquery.scrollTo-1.4.0-min.js" type="text/javascript" charset="utf-8"></script> <script src="<?php bloginfo('template_url'); ?>/style/scripts/jquery.localscroll-1.2.6-min.js" type="text/javascript" charset="utf-8"></script> <script src="<?php bloginfo('template_url'); ?>/style/scripts/jquery.serialScroll-1.2.1-min.js" type="text/javascript" charset="utf-8"></script> <script src="<?php bloginfo('template_url'); ?>/style/scripts/coda-slider.js" type="text/javascript" charset="utf-8"></script> Code (markup): so to make it work as per you i have to load jquery twice once using wp_enque & another simple script tag which I believe is wrong way to do. If I use only one - one of the wo functionalities - his or mine doesn't work. Can you suggest something..??