AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Html-Seite automatisch scrollen (JavaScript)
Thema durchsuchen
Ansicht
Themen-Optionen

Html-Seite automatisch scrollen (JavaScript)

Ein Thema von Woyzeck · begonnen am 13. Sep 2009 · letzter Beitrag vom 5. Apr 2011
 
SilverXX

Registriert seit: 30. Mär 2011
6 Beiträge
 
#15

AW: Html-Seite automatisch scrollen (JavaScript)

  Alt 30. Mär 2011, 14:59
Wow... hier bekommst man ja richtig schnell geantwortet...
Also habe mir jetzt diese HTML Datei angelegt, aber wenn ich diese aufrufe, bewegt sich nichts

Code:
<html>
<body>
<head>
<script type="text/javascript">

//var scrollSteps = 200
var scrollSteps = 50;
var timer="";

function scrollWin(anchorID) {
   if (navigator.userAgent.indexOf("Opera") == -1){ // not Opera
      var s,d;
      var test1 = document.body.scrollHeight;
      var test2 = document.body.offsetHeight
      if (test1 > test2) // all but Explorer Mac
      {
         s = document.body.scrollWidth;
         d = document.body.scrollHeight;
      }
      else // Explorer Mac;
      {    //would also work in Explorer 6 Strict, Mozilla and Safari
         s = document.body.offsetWidth;
         d = document.body.offsetHeight;
      }

      var a,b;
      if (self.innerHeight) // all except Explorer
      {
         a = self.innerWidth;
         b = self.innerHeight;
      }
      else if (document.documentElement && document.documentElement.clientHeight)
         // Explorer 6 Strict Mode
      {
         a = document.documentElement.clientWidth;
         b = document.documentElement.clientHeight;
      }
      else if (document.body) // other Explorers
      {
         a = document.body.clientWidth;
         b = document.body.clientHeight;
      }


      var y;
      if (self.pageYOffset) // all except Explorer
      {
         y = self.pageYOffset;
      }
      else if (document.documentElement && document.documentElement.scrollTop)
         {   // Explorer 6 Strict
            y = document.documentElement.scrollTop;
         }
         else if (document.body) // all other Explorers
         {
            y = document.body.scrollTop;
         }

      var id = anchorID.substring(anchorID.indexOf("#")+1,anchorID.length)
      clearTimeout(timer)

      if (y <= document.getElementById(id).offsetTop-scrollSteps)
      {   // scroll down
         window.scrollBy(0,scrollSteps);
         timer=setTimeout("scrollWin('"+id+"')",10);

         if(y > (d-b)-scrollSteps){
            clearTimeout(timer);
            y = d-b;
         }

      }
      else
      {
         if(y >= document.getElementById(id).offsetTop+scrollSteps)
         {   // scroll up
            window.scrollBy(0,-scrollSteps)
            timer=setTimeout("scrollWin('"+id+"')",10)
         }
         else
         {   // scroll the last bit (smaller than scrollSteps)
            window.scrollBy(0, document.getElementById(id).offsetTop- y);
            clearTimeout(timer)
            y = document.getElementById(id).offsetTop
         }
      }
   return false;
   }
return true;

</script>
</head>

<div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">

<!-- SCROLLER CONTENT -->

<td><iframe name="teset" id="test" scrolling="no" src="text.html" width="720" height="240" frameborder="0">Sorry, your browser doesn't support iframes.</iframe></td>

<!-- SCROLLER CONTENT ENDE -->

</div>
</body>
</html>
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:04 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz