I've done a bit of searching but so far I am confused as to what the best way to show a hidden image in CSS that only pops up if a random chance trigger in PHP happens, and during that random chance being successful, to play audio using html5.
If this is not possible, please let me know as I am trying all sorts of things.
As for rig开发者_StackOverflowht now I am using CSS to hide the image offscreen manually by a few thousand pixels, and then on a mouseover to bring it back. What I am trying to figure out is, how can you make php execute this if certain criteria are met? I want it to have a random chance of happening when an input button is clicked, this input button also loads another php document into a frame on the page, if that is of any help.
#hideme a img
{
height: 0;
width: 0;
border-width: 0;
}
#hideme a:hover img
{
position: absolute;
top:-60px;
left:40px;
height: 60px;
width: auto;
}
#hideme ul
{
list-style:none;
position:absolute;
left:-9999px;
}
#hideme ul li
{
padding-top:0px;
float:none;
margin:0px;
}
#hideme li:hover ul
{
left:-40px;
}
Is there a reason the random chance has to be with PHP? If you could use Javascript then on the onclick event of the button you could do
function onclick(e) {
if(Math.random()>.5)
$('#hideme').show();
}
And the changed css
#hideme ul
{
list-style:none;
position:absolute;
display:none;
}
精彩评论