Solved

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

Posted on 2004-08-31
10
279 Views
Last Modified: 2008-03-06
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
Comment
Question by:andreni78
  • 7
  • 3
10 Comments
 
LVL 4

Expert Comment

by:chipple
ID: 11949676
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
 
LVL 4

Accepted Solution

by:
chipple earned 500 total points
ID: 11949729
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
 

Author Comment

by:andreni78
ID: 11955373
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
 
LVL 4

Expert Comment

by:chipple
ID: 11958537
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
 

Author Comment

by:andreni78
ID: 11958947
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:andreni78
ID: 11958949
if you could put in that netscape bit in there too.. that'll be fantastic
0
 

Author Comment

by:andreni78
ID: 11961301
hello anyone out there?
0
 

Author Comment

by:andreni78
ID: 11961753
i tried what you've suggested.. i couldn't get it to work
0
 

Author Comment

by:andreni78
ID: 11969627
... hello?
0
 

Author Comment

by:andreni78
ID: 11976598
FOR FUTURE READERS - REQUESTED ANIMATE FUNCTION DOESN'T WORK
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now