我想在内容前面放置一个徽标/广告,有办法实现,但问题是他们使用JS show / hide方法。当用户观看徽标/广告时,内容不会加载,这导致用户首先等待徽标/广告,然后是实际的Flash内容加载。 所以我在想是否有一种方式可以显示徽标/广告,同时闪存内容继续在后端加载。 我没有要求一个加载器继续出现,直到后端flash内容完成加载,因为我发现只有一个脚本可以使用Jquery这样做,但它被设计为使用固定像素我的Flash内容基于%年龄
现场演示:http://bloghutsbeta.blogspot.com/2012/04/testing-game-content-issue.html
注意:很抱歉提供blogspot链接,但JsFiddle不适合居住在阿富汗的人用5KBps,但如果您觉得我遗漏了某些内容,请告诉我我会编辑它并尽力提供相关信息问题尽可能^^
相关加价: 灯箱或模态窗口的按钮
<a class="poplight" href="#?w=100%" rel="popup_name"><img alt="play game" class="happybutton" onmouseout="this.style.opacity=0.8;this.filters.alpha.opacity=80" onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100" src="http://farm5.static.flickr.com/4084/4998558471_27e3985c16_m.jpg" style="opacity: 0.8;" /></a>
在单击上面的按钮之前,内容设置为无显示
<div class="popup_block" id="popup_name">
<script type="text/javascript">
$(document).ready(function(){
$('a.poplight[href^=#]').click(function() {
$('<iframe/>')
.attr('frameborder', 0)
.attr('allowTransparency', false)
.attr('scrolling', 'no')
.attr('width', '100%')
.attr('height', '98%')
.attr('src', 'http://files.cryoffalcon.com/bhgames/dressup/Celebrities/Wizard%20Fashion.html')
.appendTo('#popup_name');
});
});
</script>
</div>
CSS:
#fade {
display: none;
background: #000;
position: fixed; left: 0; top: 0;
width: 100%; height: 100%;
opacity: .80;
z-index: 9999999;
}
.popup_block{
width: 98.95%; height: 98.2%;
display: none;
padding: 0px;
line-height:1em;
font-size: 1em;
position: fixed;
top: 0px; left: 0px;
z-index: 999999999;
-webkit-box-shadow: 0px 0px 20px #000;
-moz-box-shadow: 0px 0px 20px #000;
box-shadow: 0px 0px 20px #000;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.close {
height:20px;
float: right;
margin: 0 2px 0 0;
}
JS(实际上是Jquery)
<script type="text/javascript">
$(document).ready(function(){
//When you click on a link with class of poplight and the href starts with a #
$('a.poplight[href^=#]').click(function() {
var popID = $(this).attr('rel'); //Get Popup Name
var popURL = $(this).attr('href'); //Get Popup href to define size
//Pull Query & Variables from href URL
var query= popURL.split('?');
var dim= query[1].split('&');
var popWidth = dim[0].split('=')[1]; //Gets the first query string value
//Fade in the Popup and add close button
$('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" title="Close It" class="close"><img src="http://files.cryoffalcon.com/bloghuts/images/close%20button.png" alt="Close" width="20" height="20" /></a>');
//Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
var popMargTop = ($('#' + popID).height() + 0) / 0;
var popMargLeft = ($('#' + popID).width() + 0) / 0;
//Apply Margin to Popup
$('#' + popID).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
//Fade in Background
$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer
return false;
});
//Close Popups and Fade Layer
$('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
$('#fade , .popup_block').fadeOut(function() {
$('#fade, a.close').remove();
}); //fade them both out
return false;
});
});
</script>
答案 0 :(得分:0)
我认为您可以尝试为Flash内容设置事件以通知已下载的内容(本教程可以帮助您http://www.permadi.com/tutorial/flashjscommand/)。虽然主要内容不接收来自所有内容元素(如果不止一个)的信号,但您可以显示模态窗口或仅隐藏其他内容。