jQuery анимация. Не выполняется скрипт =(
Ребят, я не разработчик и мне трудно въехать, но сделать нужно. По-этому приложил максимум усилий чтобы все было как нужно, тем не менее ничего не выходит.
<html> <head > <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <meta name="author" content="Flux User" > <meta name="description" content="My Website" > <meta name="keywords" content="Flux, Mac" > <link href="main.css" rel="stylesheet" type="text/css" > <script type="text/javascript" src="file:///Users/..../Desktop/script/jQuery/jquery-1.4.1.min.js" > </script> <script type="text/javascript" src="file:///Users/..../Desktop/script/jQuery/star.js" > </script> <title>My Webpage </title> </head> <body style="" > <img alt="" src="file:///Users/..../Desktop/script/images/star.png" style="position:absolute; z-index:17; left:459px; top:180px; " id="star" > <script type="text/javascript" > //Create a new stardust element var StarDust = function() { var self = this; this.b = 'file:///Users/..../Desktop/script/images'; this.s = ['star.png']; this.i = this.s[this.random(this.s.length)]; this.f = this.b + this.i; this.n = document.createElement('img'); this.newSpeed().newPoint().display().newPoint().fl yacross(); }; //Random point for the X and Y StarDust.prototype.newPoint = function() { this.pointX = this.random(window.innerWidth - 100); this.pointY = this.random(350); return this; }; //Define a random speed for an element StarDust.prototype.newSpeed = function() { this.speed = (this.random(10) + 5) * 2100; return this; }; StarDust.prototype.flyacross = function() { var self = this; $(this.n).animate({ "top": this.pointY, "left": this.pointX, }, this.speed, 'linear', function(){ self.newSpeed().newPoint().flyacross(); }); }; //Display a stardust element StarDust.prototype.display = function() { $(this.n) .attr('src', this.f) .css('position', 'absolute') .css('z-index', this.random(20)) .css('top', this.pointY) .css('left', this.pointX); $(document.body).append(this.n); return this; }; // Create all the stardust var StarDust = (function(){ var totalDust = 150; var dust = []; for (i = 0; i < totalDust; i++){ dust[i] = new StarDust(); } }); // JavaScript Document </script> </body> </html> |
Это что?
|
Цитата:
|
Цитата:
|
Цитата:
|
Casiopea, может займешься важными делами?!
|
Цитата:
Пожалуйста, отформатируйте свой код! Для этого его можно заключить в специальные теги: js/css/html и т.п., например: [js] ... ваш код... [/js] О том, как вставить в сообщение исполняемый javascript и html-код, а также о дополнительных возможностях форматирования - читайте http://javascript.ru/formatting. |
Цитата:
А то что ты сделал, делают ради интереса и название у этого есть: Поиграться! |
Часовой пояс GMT +3, время: 06:20. |