views:

57

answers:

2

Hello all;

I am working on a project with a video player. I want to add play/pause and skip buttons together but one of the buttons is always invisible, however working. The codes I am using:

in .css file:

.buttons { position:absolute; top: 326px; left:150px;  }
.buttons DIV { width: 26px; height: 20px; cursor: pointer; }
.buttons .pause { background-image: url("button_pause.png"); }
.buttons .play { background-image: url("button_play.png"); }
.buttons .skip { background-image: url("button_skip.png"); }

in html file:

<div class="buttons">
    <div id="skip" onclick="skipCurrentSong();"></div>
    <div id="playpause" onclick="setPlayPause();"></div>
</div>

the functions in js file work properly but the skip button is invisible. I have tried to create a different class in css file for the skip button and updated the html file accordingly but this gave the same output also. Can anyone say what mistake I am making and how to correct it?

Thanks in advance.

Some extra codes:

.css file:

@CHARSET "UTF-8";

BODY { height: 530px; overflow: hidden; }

#tv { width: 532px; height: 443px; background: url("tv.png") no-repeat; margin: 0 auto; margin-top: 20px; z-index: 3; position: relative; }
#title { color: #dddddd; text-align: right; float: right; margin-top: 320px; margin-right: 120px; }


.buttons { position:absolute; top: 326px; left:150px;  }
.buttons DIV { width: 26px; height: 20px; cursor: pointer; background-color: white;}
.buttons .pause { background-image: url("button_pause.png"); }
.buttons .play { background-image: url("button_play.png"); }
.buttons .skip { background-image: url("button_skip.png"); }

FORM { display: block; margin: 0 auto; background: url("player.png"); height: 295px; width: 482px; clear: both; position: relative; top: -421px; margin-bottom: -295px; z-index: 4; }
FORM LABEL { color: #00aad4; margin-bottom: 10px; padding-top: 40px; }
FORM INPUT { border: none; border-bottom: 3px solid #00aad4; font-size: 24px; width: 200px; }
FORM * {  display: block; margin: 0 auto; text-align: center; }
FORM .loader { margin-top: 10px; }


.loader { background: url("load.gif"); width: 16px; height: 16px; margin: 0 auto; visibility: hidden; }
.load .loader { visibility: visible; }

in html file:

<div id="tv">

    <div id="title"></div>

    <div class="buttons">
        <div id="playpause" onclick="setPlayPause();"></div>
        <div id="skip" onclick="skipCurrentSong();"></div>
    </div>

</div>
+1  A: 

Updated: This will give you three buttons. Do you want pause/play combined?

CSS:

.buttons { position:absolute; top: 326px; left:150px;  }
.buttons div { width: 26px; height: 20px; cursor: pointer; background-color: white;}
.buttons #pause { background-image: url("button_pause.png"); }
.buttons #play { background-image: url("button_play.png"); }
.buttons #skip { background-image: url("button_skip.png"); }

HTML:

<div id="tv">

    <div id="title"></div>

    <div class="buttons">
        <div id="play" onclick="setPlayPause();"></div>
        <div id="pause" onclick="setPlayPause();"></div>
        <div id="skip" onclick="skipCurrentSong();"></div>
    </div>

</div>
lasseespeholt
When I try the first one, as you foresaw, I get the background color. So that made me think my url is wrong. But when I also change my .html file using your second suggestion, I can see all three buttons in the player properly, but only skip button works and play/pause buttons die.
yagiz
Only, then we have to get some more code from you. You don't think its just your script which is named different or ain't working?
lasseespeholt
I added some codes to the question. I don't think my script is the problem because the functions works properly, only visibility is problem.
yagiz
@yagiz You have misunderstood CSS. `.something` will match elements which have `class="something"` while `#something` will match elements which have `id="something"`. I'll look more at your code later (at Uni) if nobody else has at that time.
lasseespeholt
I have a js function that combines play and pause buttons and change the button according to the state of the player. so my aim is to have 2 buttons, play/pause and skip.
yagiz
A: 

I changed the .css code as:

.skipbutton { position:absolute; top:326px; left:120px;  }
.skipbutton DIV { width: 26px; height: 20px; cursor: pointer; background-color: gray;}
.skipbutton .skip { background-image: url("button_skip.png"); }

.buttons { position:absolute; top: 326px; left:90px;  }
.buttons DIV { width: 26px; height: 20px; cursor: pointer;  }
.buttons .pause { background-image: url("button_pause.png"); }
.buttons .play { background-image: url("button_play.png"); }

and changed .html as:

<div id="tv">

    <div id="title"></div>

    <div class="skipbutton">
        <div class="skip" onclick="skipCurrentSong();"></div>
    </div>

    <div class="buttons">
        <div id="playpause" onclick="setPlayPause();"></div>
    </div>

</div>

surpsiringly for skip button div class worked while for playpause button, div id works and div class just kills the button. It is a little awkward as the two buttons have the same structe in css file.

I tried to seperate the classes for two buttons earlier but this time it finally worked.

Thanks to lasseespeholt.

yagiz
I'm glad you found a solution :-) But next time, you would have to provide more code (in this case the combining js-function). From what you have I would not be able to tell whether this works or not. But I can see that the css would not apply to play/pause without the js-function.
lasseespeholt