малко помощ за един скрипт

Post Reply
J01nt
Потребител
Потребител
Posts: 915
Joined: Thu Oct 09, 2008 8:51 pm
Answers: 16

малко помощ за един скрипт

Post by J01nt » Wed Nov 19, 2008 3:47 pm

http://212.233.226.16/test.php някой може ли да направи така че като се покаже да се скрива след 2 сек примерно ето го и кода :( и искам като цъкна с мишката да се скрива пак +++ хелп



Code: Select all

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<style type="text/css">
#dhtmlgoodies_leftPanel&#123;

background-color&#58;#CCCCCC;
color&#58;#FFF;
font-family&#58; Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;

/* не променяйте */ 
height&#58;100%; 
left&#58;0px;
z-index&#58;10;
position&#58;absolute;
display&#58;none;
&#125;

#dhtmlgoodies_leftPanel #leftPanelContent&#123;
padding&#58;0px;
&#125;
#dhtmlgoodies_leftPanel .closeLink&#123; 
padding-left&#58;2px;
padding-right&#58;2px;
background-color&#58;#FFF;
position&#58;absolute;
top&#58;2px;
right&#58;2px;
border&#58;1px solid #000;
color&#58;#000;
font-size&#58;0.8em; 
&#125;
#dhtmlgoodies_leftPanel .closeLink&#58;hover&#123;
color&#58;#FFF;
background-color&#58;#000;
&#125; 

</style>
<script type="text/javascript">
var panelWidth = 150; 
var slideSpeed = 15; 
var slideTimer = 10; 
var slideActive = true;
var initBodyMargin = top;
var pushMainContentOnSlide = false; 
var panelPosition = 1; // 0 = left , 1 = top

/* не променяй */
var slideLeftPanelObj=false;
var slideInProgress = false; 
var startScrollPos = false;
var panelVisible = false;
function initSlideLeftPanel&#40;expandOnly&#41;
&#123;
if&#40;slideInProgress&#41;return;
if&#40;!slideLeftPanelObj&#41;&#123;
if&#40;document.getElementById&#40;'dhtmlgoodies_leftPanel'&#41;&#41;&#123; // Object exists in HTML code?
slideLeftPanelObj = document.getElementById&#40;'dhtmlgoodies_leftPanel'&#41;;
if&#40;panelPosition == 1&#41;slideLeftPanelObj.style.width = '100%';
&#125;else&#123; // Object doesn't exist -> Create <div> dynamically
slideLeftPanelObj = document.createElement&#40;'DIV'&#41;;
slideLeftPanelObj.id = 'dhtmlgoodies_leftPanel';
slideLeftPanelObj.style.display='none';
document.body.appendChild&#40;slideLeftPanelObj&#41;;
&#125;

if&#40;panelPosition == 1&#41;&#123;
slideLeftPanelObj.style.top = "-" + panelWidth + 'px';
slideLeftPanelObj.style.left = '0px'; 
slideLeftPanelObj.style.height = panelWidth + 'px'; 
&#125;else&#123;
slideLeftPanelObj.style.left = "-" + panelWidth + 'px';
slideLeftPanelObj.style.top = '0px';
slideLeftPanelObj.style.width = panelWidth + 'px';
&#125;


if&#40;!document.all || navigator.userAgent.indexOf&#40;'Opera'&#41;>=0&#41;slideLeftPanelObj.style.position = 'fixed';;
&#125; 

if&#40;panelPosition == 0&#41;&#123;
if&#40;document.documentElement.clientHeight&#41;&#123;
slideLeftPanelObj.style.height = document.documentElement.clientHeight + 'px';
&#125;else if&#40;document.body.clientHeight&#41;&#123;
slideLeftPanelObj.style.height = document.body.clientHeight + 'px';
&#125;
var leftPos = slideLeftPanelObj.style.left.replace&#40;/&#91;^0-9\-&#93;/g,''&#41;/1;
&#125;else&#123;
if&#40;document.documentElement.clientWidth&#41;&#123;
slideLeftPanelObj.style.width = document.documentElement.clientWidth + 'px';
&#125;else if&#40;document.body.clientHeight&#41;&#123;
slideLeftPanelObj.style.width = document.body.clientWidth + 'px';
&#125;
var leftPos = slideLeftPanelObj.style.top.replace&#40;/&#91;^0-9\-&#93;/g,''&#41;/1; 


&#125;
slideLeftPanelObj.style.display='block';

if&#40;panelPosition==1&#41;
startScrollPos = Math.max&#40;document.body.scrollTop,document.documentElement.scrollTop&#41;;
else
startScrollPos = Math.max&#40;document.body.scrollLeft,document.documentElement.scrollLeft&#41;;
if&#40;leftPos<&#40;0+startScrollPos&#41;&#41;&#123;
if&#40;slideActive&#41;&#123;
slideLeftPanel&#40;slideSpeed&#41;; 

&#125;else&#123;
document.body.style.marginLeft = panelWidth + 'px';
slideLeftPanelObj.style.left = '0px';
&#125;
&#125;else&#123;
if&#40;expandOnly&#41;return;
if&#40;slideActive&#41;&#123; 
slideLeftPanel&#40;slideSpeed*-1&#41;;
&#125;else&#123;
if&#40;panelPosition == 0&#41;&#123;
if&#40;pushMainContentOnSlide&#41;document.body.style.marginLeft = initBodyMargin + 'px';
slideLeftPanelObj.style.left = &#40;panelWidth*-1&#41; + 'px'; 
&#125;else&#123;
if&#40;pushMainContentOnSlide&#41;document.body.style.marginTop = initBodyMargin + 'px';
slideLeftPanelObj.style.top = &#40;panelWidth*-1&#41; + 'px'; 
&#125; 
&#125;
&#125; 

if&#40;navigator.userAgent.indexOf&#40;'MSIE'&#41;>=0 && navigator.userAgent.indexOf&#40;'Opera'&#41;<0&#41;&#123;
window.onscroll = repositionHelpDiv;

repositionHelpDiv&#40;&#41;;
&#125;
window.onresize = resizeLeftPanel;

&#125;

function resizeLeftPanel&#40;&#41;
&#123;
if&#40;panelPosition == 0&#41;&#123;
if&#40;document.documentElement.clientHeight&#41;&#123;
slideLeftPanelObj.style.height = document.documentElement.clientHeight + 'px';
&#125;else if&#40;document.body.clientHeight&#41;&#123;
slideLeftPanelObj.style.height = document.body.clientHeight + 'px';
&#125; 
&#125;else&#123;
if&#40;document.documentElement.clientWidth&#41;&#123;
slideLeftPanelObj.style.width = document.documentElement.clientWidth + 'px';
&#125;else if&#40;document.body.clientWidth&#41;&#123;
slideLeftPanelObj.style.width = document.body.clientWidth + 'px';
&#125; 
&#125;
&#125;

function slideLeftPanel&#40;slideSpeed&#41;&#123;
slideInProgress =true;
var scrollValue = 0;
if&#40;panelPosition==1&#41;
var leftPos = slideLeftPanelObj.style.top.replace&#40;/&#91;^0-9\-&#93;/g,''&#41;/1;
else
var leftPos = slideLeftPanelObj.style.left.replace&#40;/&#91;^0-9\-&#93;/g,''&#41;/1;

leftPos+=slideSpeed;
okToSlide = true;
if&#40;slideSpeed<0&#41;&#123;
if&#40;leftPos < &#40;&#40;panelWidth*-1&#41; + startScrollPos&#41;&#41;&#123;
leftPos = &#40;panelWidth*-1&#41; + startScrollPos; 
okToSlide=false;
&#125;
&#125;
if&#40;slideSpeed>0&#41;&#123;
if&#40;leftPos > &#40;0 + startScrollPos&#41;&#41;&#123;
leftPos = 0 + startScrollPos;
okToSlide = false;
&#125; 
&#125;


if&#40;panelPosition==0&#41;&#123;
slideLeftPanelObj.style.left = leftPos + startScrollPos + 'px';
if&#40;pushMainContentOnSlide&#41;document.body.style.marginLeft = leftPos - startScrollPos + panelWidth + 'px';
&#125;else&#123;
slideLeftPanelObj.style.top = leftPos + 'px';
if&#40;pushMainContentOnSlide&#41;document.body.style.marginTop = leftPos - startScrollPos + panelWidth + 'px'; 

&#125;
if&#40;okToSlide&#41;setTimeout&#40;'slideLeftPanel&#40;' + slideSpeed + '&#41;',slideTimer&#41;; else &#123;
slideInProgress = false;
if&#40;slideSpeed>0&#41;panelVisible=true; else panelVisible = false;
&#125;

&#125;


function repositionHelpDiv&#40;&#41;
&#123;
if&#40;panelPosition==0&#41;&#123;
var maxValue = Math.max&#40;document.body.scrollTop,document.documentElement.scrollTop&#41;;
slideLeftPanelObj.style.top = maxValue;
&#125;else&#123;
var maxValue = Math.max&#40;document.body.scrollLeft,document.documentElement.scrollLeft&#41;;
slideLeftPanelObj.style.left = maxValue; 
var maxTop = Math.max&#40;document.body.scrollTop,document.documentElement.scrollTop&#41;;
if&#40;!slideInProgress&#41;slideLeftPanelObj.style.top = &#40;maxTop - &#40;panelVisible?0&#58;panelWidth&#41;&#41; + 'px'; 
&#125;
&#125;

function cancelEvent&#40;&#41;
&#123;
return false;
&#125;
function keyboardShowLeftPanel&#40;&#41;
&#123;
initSlideLeftPanel&#40;&#41;;
return false; 

&#125;

function leftPanelKeyboardEvent&#40;e&#41;
&#123;
if&#40;document.all&#41;return;

if&#40;e.keyCode==112&#41;&#123;
initSlideLeftPanel&#40;&#41;;
return false;
&#125; 
&#125;

function setLeftPanelContent&#40;text&#41;
&#123;
document.getElementById&#40;'leftPanelContent'&#41;.innerHTML = text;
initSlideLeftPanel&#40;true&#41;;

&#125;
if&#40;!document.all&#41;document.documentElement.onkeypress = leftPanelKeyboardEvent;
document.documentElement.onhelp = keyboardShowLeftPanel;

</script>
</head>
<body>
<div id="dhtmlgoodies_leftPanel">
<a class="closeLink" href="#" onclick="initSlideLeftPanel&#40;&#41;;return false">затвори</a>
<div id="leftPanelContent">
<div>
<p>J01nt </p>
<ul>
<li>asdasdasdasdasd</li>
<li>asdasdasdasdasd</li>

</ul>
</div>
<!-- End content -->
</div>
</div>
<!--- тук слагате кода на страницата --->
<a href="#" onclick="initSlideLeftPanel&#40;&#41;;return false">кликни тук!</a> или натисни "F1"
</body>
</html>

phpsessid
Нов
Нов
Posts: 81
Joined: Mon Oct 02, 2006 9:07 am
Location: Kosmosa
Contact:

ухуи

Post by phpsessid » Wed Nov 19, 2008 3:55 pm

например ако накрая на функцията дето го показва да добавиш един setTimeOut за функцията на скриване не виждам нещо трудно.

Code: Select all

function showLine&#40;&#41; &#123;
code.. ala bala ...
...
...
setTimeout&#40;"hideLine&#40;&#41;", 2000&#41;;
&#125;
function hideLine&#40;&#41; &#123;
kod za skrivane ne lentata...
&#125;
............................................................................................................................................

Post Reply