рони, чудасия какая-то, открываю ваш пример в ie, всё работает, открываю свой файлик - нет :( изза доктайпа html5 чтоли?
|
Цитата:
если нужно без DOCTYPE тогда без document.querySelector
var input = document.getElementsByTagName("input")[0] ;
или document.getElementById |
рони, благодарю!
Я наверно вам уже надоел, но гляньте ещё, пожалуйста, делаю мини джейквери для народа, не хочет работать slideUp
function _init_(el){
this.s = document.querySelectorAll(el);
}
// главная и самая сложная функшн
function _A_(el){
return new _init_(el)
}
_init_.prototype.css = function(obj){
if(typeof obj === 'object'){
for (var e = 0; e < this.s.length; e++){
for (i in obj){
this.s[e].style[i] = obj[i];
}
}
return this;
}
else {
if(obj === 'width') return this.s[0].offsetWidth;
if(obj === 'height') return this.s[0].offsetHeight
else return this.s[0].style[obj] || getComputedStyle(this.s[0])[obj];
}
}
_init_.prototype.attr = function(){
}
_init_.prototype.slideUp = function (duration){
this.css({'overflow' : 'hidden'});
var height = parseInt(this.css('height'));
for(var i = 1; i <= height ; i++){
(function(i){
setTimeout(function(){
this.css({'height' : (height-i)+'px'}); // this.css is not a function. хотя overflow устанавливает перед этим
}, i*duration/height);
})(i);
}
return this;
}
|
sash003,
таймер ничего не знает про твой this -- сохрани 31 var self = this; 37 self.css |
Не работает, консоль молчит как подкупленная :) Да что за напасть такая, что не копни, кругом засада :(
|
sash003,
делайте макет |
sash003,
:-?
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
p{
height: 200px;
background-color: #0000CC;
}
</style>
</head>
<body>
<p></p>
<script>
function _init_(el){
this.s = document.querySelectorAll(el);
}
// главная и самая сложная функшн
function _A_(el){
return new _init_(el)
}
_init_.prototype.css = function(obj){
if(typeof obj === 'object'){
for (var e = 0; e < this.s.length; e++){
for (i in obj){
this.s[e].style[i] = obj[i];
}
}
return this;
}
else {
if(obj === 'width') return this.s[0].offsetWidth;
if(obj === 'height') return this.s[0].offsetHeight
else return this.s[0].style[obj] || getComputedStyle(this.s[0])[obj];
}
}
_init_.prototype.attr = function(){
}
_init_.prototype.slideUp = function (duration){
var self = this;
this.css({'overflow' : 'hidden'});
var height = parseInt(this.css('height'));
for(var i = 1; i <= height ; i++){
(function(i){
setTimeout(function(){
self.css({'height' : (height-i)+'px'}); // this.css is not a function. хотя overflow устанавливает перед этим
}, i*duration/height);
})(i);
}
return this;
}
var x = _A_("p");
x.slideUp(3000)
</script>
</body>
</html>
|
БЛАГОДАРЮ, ДРУЖИЩЕ!
Я как всегда не туда смотрел :) ТОЛЬКО для блочных элементов работает, а я пытался ссылку скрыть. Даже для инлайн блок не работает |
Тему не читал, ибо ишаку бортовой номер 8 давно уже показывают сервер нот фаунд.
|
| Часовой пояс GMT +3, время: 10:31. |