SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Nov 2007
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Div close button issue

    Hi,

    I have a div that appears as you scroll to the bottom of the page and then fades out as you scroll back up. I would like to add a close button to the div which I have done and sort of works. It closes the div, but if you scroll, it appears again.

    This is my code:
    PHP Code:
    function toggle() {
        var 
    ele document.getElementById("offerbox");
        var 
    text document.getElementById("displayText");
        if(
    ele.style.display == "block") {
                
    ele.style.display "none";
            
    text.innerHTML "show";
          }
        else {
            
    ele.style.display "block";
            
    text.innerHTML "hide";
        }

    $(
    document).ready(function(){
     $(
    window).scroll(function(){
      
    // get the height of #wrap
      
    var = $('#wrapper').height();
      var 
    = $(window).scrollTop();
      if( 
    > (h*.25) && < (h*.75) ){
       
    // if we are show keyboardTips
       
    $("#offerbox").fadeIn("1000");
      } else {
       $(
    '#offerbox').fadeOut('1000');
      }
     });
    }) 
    Any ideas whats wrong?

    Thanks

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,938
    Mentioned
    214 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Could you post a link to a page where I could see this in action?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •