Title: Javascript issue in header.php
Last modified: August 19, 2016

---

# Javascript issue in header.php

 *  [lahoti](https://wordpress.org/support/users/lahoti/)
 * (@lahoti)
 * [17 years ago](https://wordpress.org/support/topic/javascript-issue-in-headerphp/)
 * Hi
 * I am trying to have a floating div block. For that i Have done following:
 * In header.php (using jQuery):
 *     ```
       $(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");
       });
       });
       ```
   
 * 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. Seems like problem with my javascript ($(document).
   ready(function() isnt called again probably in other page) but am not sure
 * Thanks

Viewing 1 replies (of 1 total)

 *  Thread Starter [lahoti](https://wordpress.org/support/users/lahoti/)
 * (@lahoti)
 * [17 years ago](https://wordpress.org/support/topic/javascript-issue-in-headerphp/#post-1086854)
 * here by last statement I meant issue looks somewhere at that point cause fr the
   first time on landing page its fine… but not on pages/ post pages

Viewing 1 replies (of 1 total)

The topic ‘Javascript issue in header.php’ is closed to new replies.

## Tags

 * [header](https://wordpress.org/support/topic-tag/header/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 1 reply
 * 1 participant
 * Last reply from: [lahoti](https://wordpress.org/support/users/lahoti/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/javascript-issue-in-headerphp/#post-1086854)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
