[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

MTV.com home page hide banner function.. hide banner animation

If you visit www.mtv.com for the first time.. you will see a 728x90 banner there.. after 7 seconds.. the banner is hidden by a page animation up..  can someone create a script that does this for me? Here are the requirements:

1.  Banner hides using <div> or <span> in a time i can specify(in seconds)
2.  <div> or <span> around a banner does not show again at a time i can specify(in hours) - so basically this script resets itself at any time i wish..

Thanks!
0
andreni78
Asked:
andreni78
  • 7
  • 3
1 Solution
 
chippleCommented:
It's copyrighted so you'll need to make your own.
Otherwise you can open the source, find the banner yourself and do what you like, but helping you goes against this forum's user agreement.
0
 
chippleCommented:
OOPS sorry, I hadn't read your whole post and thought you were asking for someone to provide you mtv.com's script.

So here's something that should do the job.

<div id="myBanner">
hello!
</div>
<script type="text/javascript"><!--
var iNbSecondsBeforeHiding = 7;
var iNbHoursToHide = 24;
if (("&"+document.cookie).indexOf("&hidebanner=1") != -1)
  f_hideBanner();
else {
  setTimeout("f_hideBanner();",iNbSecondsBeforeHiding*1000)
  document.cookie = "hidebanner=1;expires="+(new Date((new Date()).getTime()+iNbHoursToHide*60*60*1000)).toGMTString();
}
function f_hideBanner() {
  if (document.getElementById)
    document.getElementById("myBanner").style.display = "none";
  else if (document.all)
    document.all["myBanner"].style.display = "none";
}
//--></script>

Good luck!
0
 
andreni78Author Commented:
thanks! nice work.. only one thing.. can you make it animate up instead of just dissappear?

i already have a javascript animate up/down already.. check here:
if you select "D" you will see animation -
http://majestic.gotdns.com/methoda.htm

it also works on netscape.. but it doesn't animate in netscape..
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
chippleCommented:
Just replace the f_hideBanner function by that animate function. You may also have to adjust a few things like the name of the myBanner div.
0
 
andreni78Author Commented:
I'm really newb with javascript.. can you implement all that for me?

here's the show/hide script:

    function toggle(obj,nm)
    {

    theDiv=document.getElementById(nm);
    theDiv.style.top=getOffsetTop(obj)+23;

     if (navigator.appName.indexOf('Explorer')){
      animate(theDiv.id, obj);
     }
     else // non ie browsers
     {
       if(theDiv.style.display=="none")
       {
         theDiv.style.height="400";
          theDiv.style.display = "";
       }
       else
       {
         theDiv.style.display = "none";
       }
     }
  }



  function animate(obj, obj_Sel)
  {
    objID = document.getElementById(obj);
    objID.style.color='#D1CCC5';
    if ((obj_Sel.options[obj_Sel.selectedIndex].value == 'Other') || (obj_Sel.options[obj_Sel.selectedIndex].value = ''))
     {
       objID.style.display = "";
        display_DIV(obj);
    }
     else
    {
       hide_DIV(obj,objID.style.pixelHeight);
     }
  }

  function hide_DIV(obj,height)
  {
    objID = document.getElementById(obj);
    objID.style.pixelHeight=height
    if (height>0)
     {
      setTimeout("hide_DIV('" + obj + "'," + (height-25) + ")",5);
     }
    else
     {
       objID.style.color='#000000';
      objID.style.display = "none";
    }
  }

  function display_DIV(obj,height)
  {
    objID = document.getElementById(obj);
    if (height==undefined){height=1;}
    objID.style.pixelHeight=height
    if (height<350)
     {
      setTimeout("display_DIV('" + obj + "'," + (height+25) + ")",5);
     }
    else
     {
       objID.style.color='#000000';
     }
  }

  function getOffsetLeft (el)
  {
    var ol = el.offsetLeft;
    while ((el = el.offsetParent) != null)
      ol += el.offsetLeft;
      return ol;
  }

  function getOffsetTop (el)
  {
    var ot = el.offsetTop;
    while((el = el.offsetParent) != null)
      ot += el.offsetTop;
      return ot;
  }
0
 
andreni78Author Commented:
if you could put in that netscape bit in there too.. that'll be fantastic
0
 
andreni78Author Commented:
hello anyone out there?
0
 
andreni78Author Commented:
i tried what you've suggested.. i couldn't get it to work
0
 
andreni78Author Commented:
... hello?
0
 
andreni78Author Commented:
FOR FUTURE READERS - REQUESTED ANIMATE FUNCTION DOESN'T WORK
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now