Привет Гость!
Ты должен:
зарегистрироваться
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Выезжающая панель от $USERNAME$
GryshaДата: Воскресенье, 13.06.2010, 14:46 | Сообщение # 1
Подполковник
Группа: Администраторы
Сообщений: 112
Репутация: 0
Статус: Offline
Пример
Выезжает при наводке мышью.
Полностью кроссбраузерная.
На чистом JavaScript, никакого jQuery.

Установка:

1. Установим скрипт, который будет реализовывать плавание панели:

Code
<script type="text/javascript">    
    function slide(obj, direction, a) {    
    clearInterval(window.z);    
    counter = 0;    
    z = setInterval(function () {    
    if (a ? parseInt(obj.style.marginTop) < 0 : parseInt(obj.style.marginTop) > -300) {    
    obj.style.marginTop = parseInt(obj.style.marginTop) + direction;    
    counter++;    
    } else {    
    clearInterval(z);    
    }    
    },    
    10);    
    }    
    var pad = document.getElementById('x');    
    pad.onmouseover = function () {    
    slide(this, 3, true);    
    }    
    pad.onmouseout = function () {    
    slide(this, -3, false);    
    }    
    </script>

2. Установим саму панель:
Code
<div id="x" style="width: 100%; height: 300px; border-bottom: 5px dashed #eee; background: #555; position: absolute; margin-top: -300px;">    
    <span style="color: white; font-weight: bold;">    
    Slide Panel by $USERNAME$    
     
     
    Кстати, на чистом JS, без jQuery <img rel="usm" src="http://megasoft.3dn.ru/emoticons/Sypsena.gif" border="0" align="absmiddle" alt=":)">    
     
     
    Хотя кого это волнует.    
    </span>    
    </div>

Внутри неё можно поставить форму входа, регистрации, мини-профиль, информер — в-общем, всё что захотите.

По просьбам сделал панель выезжащей сбоку:
Пример
HTML

Code
<div id="x" style="width: 300px; height: 50%; border-right: 5px dashed #eee; background: #555; position: absolute; margin-left: -300px; margin-top: 100px;">    
    <span style="color: white; font-weight: bold;">    
    Slide Panel by $USERNAME$    
     
     
    Кстати, на чистом JS, без jQuery <img rel="usm" src="http://megasoft.3dn.ru/emoticons/Sypsena.gif" border="0" align="absmiddle" alt=":)">    
     
     
    Хотя кого это волнует.    
    </span>    
    </div>

JavaScript:
Code
<script type="text/javascript">    
    function slide(obj, direction, a) {    
    clearInterval(window.z);    
    counter = 0;    
    z = setInterval(function () {    
    if (a ? parseInt(obj.style.marginLeft) < 0 : parseInt(obj.style.marginLeft) > -300) {    
    obj.style.marginLeft = parseInt(obj.style.marginLeft) + direction;    
    counter++;    
    } else {    
    clearInterval(z);    
    }    
    },    
    10);    
    }    
    var pad = document.getElementById('x');    
    pad.onmouseover = function () {    
    slide(this, 3, true);    
    }    
    pad.onmouseout = function () {    
    slide(this, -3, false);    
    }    
    </script>
 



 
  • Страница 1 из 1
  • 1
Поиск: