Jump to content
php.lv forumi

Banera slīdēšana par web lapu


-=Martini=-

Recommended Posts

alins--> kaitinoshi tas tiesa, bet arii efektiivi...

ja nav paaraak uzbaaziiga un saits ir intresantstad var pieciest...

 

-=Martini=- --> pamatprincips ir DIVa kordinaashu mainiishana ar nelieliem laika intervaaliem...

pameklee goglee par DHTML gandriiz katraa lapaa kur tiek aprakstiita DHTML ir arii shaadi peimeeri....

Link to comment
Share on other sites

vismaz tiek atbildēts nevis pēc stundas ;)
tas atkariigs vai kaadam ir laiks ko dariit...var paiet arii krietni vairaak kaa stunda ;)

-------------

gatavus skriptus te neviens nerakstiis!

-----

kaa jau mineeju:

ar noteiktu intervaalu dinamiski mani DIV kordinaates

 

kordinaates=kordinaates+solis;

getElementById('DIVa_ID').style.left=kordinaates;

Link to comment
Share on other sites

======================Shis ir html fails ar kuru tiek palaists JavaScripts ===============

<html>

 

<head>

<title></title>

<script type="text/javascript" src="moveobj.js"> </script>

<script type="text/javascript">

 

/***********************************************

* Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)

* Modified by Dynamic Drive for various improvements

* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

***********************************************/

 

<!--//Step 1: Define unique variable names depending on number of flying images (ie:3):-->

var flyimage2

 

function pagestart(){

<!--//Step 2: Using the same variable names as 1), add or delete more of the below lines (60=width, height=80 of image):-->

flyimage2=new Chip("flyimage2",6,8);

<!--//Step 3: Using the same variable names as 1), add or delete more of the below lines:-->

movechip("flyimage2");

}

 

if (window.addEventListener)

window.addEventListener("load", pagestart, false)

else if (window.attachEvent)

window.attachEvent("onload", pagestart)

else if (document.getElementById)

window.onload=pagestart

 

</script>

</head>

 

<body>

 

<!-- Step 4: Define your flying images. For each image's ID tag, use the same variable names as 1) above -->

 

<DIV ID="flyimage2" STYLE="position:absolute; left: -500px; width:6; height:8;">

<A HREF="http://dynamicdrive.com"><IMG SRC="flyimage2.gif" BORDER=0></a>

</DIV>

 

</body>

 

</html>

========================Sheit html fails beidzas==============================

 

 

=======================Shis ir JavaScript fails ar nosaukumu moveobj.js==============

/***********************************************

* Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)

* Modified by Dynamic Drive for various improvements

* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

***********************************************/

 

 

var vmin=2;

var vmax=5;

var vr=2;

var timer1;

var StayAlive = 15;

 

function iecompattest(){

return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body

}

 

function Chip(chipname,width,height){

this.named=chipname;

this.vx=vmin+vmax*Math.random();

this.vy=vmin+vmax*Math.random();

this.w=width+20;

this.h=height;

this.xx=Math.random()*800;

this.yy=Math.random()*800;

this.timer1=null;

}

 

function movechip(chipname){

if (document.getElementById){

eval("chip="+chipname);

if (window.innerWidth || window.opera){

pageX=window.pageXOffset;

pageW=window.innerWidth-40;

pageY=window.pageYOffset;

pageH=window.innerHeight-20;

}

else if (document.body){

pageX=iecompattest().scrollLeft;

pageW=iecompattest().offsetWidth-40;

pageY=iecompattest().scrollTop;

pageH=iecompattest().offsetHeight-20;

}

 

chip.xx=chip.xx+chip.vx;

chip.yy=chip.yy+chip.vy;

 

chip.vx+=vr*(Math.random()-0.5);

chip.vy+=vr*(Math.random()-0.5);

if(chip.vx>(vmax+vmin)) chip.vx=(vmax+vmin)*2-chip.vx;

if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;

if(chip.vy>(vmax+vmin)) chip.vy=(vmax+vmin)*2-chip.vy;

if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;

 

if(chip.xx<=pageX){

chip.xx=pageX;

chip.vx=vmin+vmax*Math.random();

}

if(chip.xx>=pageX+pageW-chip.w){

chip.xx=pageX+pageW-chip.w;

chip.vx=-vmin-vmax*Math.random();

}

if(chip.yy<=pageY)

{chip.yy=pageY;

chip.vy=vmin+vmax*Math.random();

}

if(chip.yy>=pageY+pageH-chip.h)

{chip.yy=pageY+pageH-chip.h;

chip.vy=-vmin-vmax*Math.random();

}

 

document.getElementById(chip.named).style.left=chip.xx+"px";

document.getElementById(chip.named).style.top=chip.yy+"px";

 

 

chip.timer1=setTimeout("movechip('"+chip.named+"')",100);

 

}

}

 

===========================Sheit JavaScript beidzas==========================

 

*) Vienalga kada bildite ar nosaukumu flyimage2.gif tiek izmantota

*) Abi faili un bildite atrodas vienaa mapee

 

 

1)Luudzu apskatieties kapec izmainot html faila width un height bildes izmers nemainaas?

2)Vel pedejais lugums. Ar kadu funkciju vai kaa savadak pec noteikta laika (pienemsim pec 30 sekundem) pazuud bildiite, kas visu laiku lidinajas pa visu web lapu?

Link to comment
Share on other sites

Es abiem mainiju, bet rezultats tas pats ieprieks kas jau bija.Par paste.php.lv turpmak es to iegaumeshu.

 

Par bildes izmeriem man beidzot izdevas izmainit. Vel vienigi ir atlicis par bildes pazushanu pec 30 sekundem. Ja vienigi es zinatu konkretu funkciju, tad es varetu meginat kaut ko lietas laba daritu.

Link to comment
Share on other sites

×
×
  • Create New...