 | |
| web_master | May 5th, 2008 10:59 am | |
| Javascript Problem....Simple for experts i guess..... Javascripters plz help
I have made a little slider below(not perfect i know)....and i have some bugs in it......
help me debug them plz
i want 'marq_box' to hide as soon as height of 'slide_box' is less than 219px. therefore i made the function hideInnerSlide(); which ofcourse is wrong that is why the script is not working.....can anyone help me with this.....plz
in my css the original height of 'silde_box' is 220px;
the javascript code is below:
<script type="text/javascript">
var active= 1;
var height= 300;
function toggle_visible(){
if(active==0){
active = 1;
divminus();
}
else if(active==1){
active = 0;
divplus();
}
}
function divminus(){
if(height>=1){
height = height - 5;
document.getElementById('slide_box').style.height = height + "px";
hideInnerSlide();
window.setTimeout('divminus()',1);
}
else{
document.getElementById'slide_box').style.display="none";
}
}
function divplus(){
if(height <= 300){
document.getElementById('slide_box').style.display="block";
height = height + 5;
document.getElementById('slide_box').style.height = height + "px";
window.setTimeout('divplus()',1);
}
}
function hidePtr(){
shown = document.getElementById('pointer').style.visibility == "visible";
unshown= document.getElementById('pointer').style.visibility = "hidden";
if(shown){
document.getElementById('pointer').style.visibility = "hidden";
}
else if(unshown)
{
document.getElementById('pointer').style.visibility == "visible";
}
function hideInnerSlide(){
ht = document.getElementById('slide_box').style.height;
if(ht <= 219)
{
document.getElementById('marq_box').style.display="none";
divminus();
}
}
}
</script>
for any more info about the code please ask....
but plz help......
Thanks All....... |
| web_master | May 5th, 2008 3:29 pm | |
| Re: Javascript Problem....Simple for experts i guess..... i figured it out myself:
i used the height vaiable i declared on top for comparing and inside divminus() and divplus()
and removed the hideInnerSlide() completely
CODE:
var active= 0;
var height= 0;
function toggle_visible(){
if(active==0){
active = 1;
divplus();
}
else if(active==1){
active = 0;
divminus();
}
}
function divminus(){
if(height>=1){
height = height - 5;
document.getElementById('slide_box').style.height = height + "px";
if(height < 230){
document.getElementById('marq_box').style.display="none";
}
window.setTimeout('divminus()',1);
}
else{
document.getElementById('slide_box').style.display="none";
}
}
function divplus(){
if(height <= 250){
document.getElementById('slide_box').style.display="block";
height = height + 5;
document.getElementById('slide_box').style.height = height + "px";
if(height > 240){
document.getElementById('marq_box').style.display="block";
}
window.setTimeout('divplus()',1);
}
}
function hidePtr(){
shown = document.getElementById('pointer').style.visibility == "visible";
unshown= document.getElementById('pointer').style.visibility = "hidden";
if(shown){
document.getElementById('pointer').style.visibility = "hidden";
}
else if(unshown)
{
document.getElementById('pointer').style.visibility == "visible";
}
} |
| All times are GMT -4. The time now is 8:19 pm. | |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC