hi,

i got some kind of pop-up banner which animates in the screen after
the page loaded. if you scroll up or down it will animate back on the
position it has to be. if you click on "close" it moves out of the
screen.

well actually i just animate the height of it so it doesn't really
move out or in but nevermind.

my problem now is:

if i scrolled around and close the banner afterwards the page gets
"longer". i don't know why but i can scroll way down under the page
where nothing is.
this sucks. i hope someone got an idea.

code:

/**
         *      pop-up werbebanner
         *      +cookie
         */
        var scrollpos = document.documentElement.scrollTop;
        var winh = document.documentElement.clientHeight;
        var pos = -1;
        var closed = 0;

        if(!$("body").hasClass("browser-ie6"))
        {
                var popcookie = $(".popup").attr("id");
                $("#popup-1").css({zIndex:"101"});
                var popp= $.cookie('popp');
                 if (popp == popcookie)
                 {
                         $(".popup").css({height:"0px"});
                 }else{
                         $(".popup").css("bottom",pos);
                         $(".popup").animate({height: "200px"},1000);
                         $(".popup .close").click(function()
                        {

                                $(".popup").animate({height: "0px"},1000, 
function()
                                {
                                        $(this).css({border:"0px"});
                                });
                                var popcookie = $(".popup").attr("id");

                                $.cookie('popp', popcookie, { expires: 1 });
                        });
                 }
        }else{
                $(".popup").before("<div class='backgimg'></div>");
                $(".backgimg").css
("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader
(src='sites/default/themes/basic/images/popupbg.png',
sizingMethod='scale'");
                $(".backgimg").css
({position:"absolute",width:"100%",left:"0px",margin:"0px",padding:"0px",height:"0px"});
                $(".popup").css({position:"absolute",overflow:"hidden"});
                var popcookie = $(".popup").attr("id");

                var popp= $.cookie('popp');
                 if (popp == popcookie)
                 {
                         $(".popup").css({height:"0px"});
                 }else{
                         $(".popup").css("bottom",pos);
                         $(".backgimg").css("bottom",pos);

                         $(".popup").animate({height: "200px"},1000);
                         $(".backgimg").animate({height: "200px"},1000);
                         $(".popup .close").click(function()
                        {
                                closed =1;
                                $(".backgimg").animate({height: "0px"},1000);
                                $(".popup").animate({height: "0px"},1000, 
function()
                                {
                                        
$(this).css({border:"0px",display:"none"}).remove();
                                        
$(".backgimg").css({display:"none"}).remove();
                                });
                                var popcookie = $(".popup").attr("id");

                                $.cookie('popp', popcookie, { expires: 1 });
                        });
                         if(closed==0){
                                 $(window).scroll(function () {
                                        var scrollpos = 
document.documentElement.scrollTop;
                                        var winh = 
document.documentElement.clientHeight;
                                        var pos2 = scrollpos- 200+winh;//-49;
                                        $('.popup').css({top: pos2,bottom: 
"1px"});
                                        $(".backgimg").css({top: pos2,bottom: 
"1px"});
                                });
                         }
                 }
        }

thanks in advance.

--weidc

Reply via email to