I have Flash files in a Document Library. I wanted to have users click the flash files (swf) and have them open up in a hidden div, rather than opening in a different window. I added the code below to a CEWP:
<script type="text/javascript" src="http://jquery.thewikies.com/swfobject/jquery.swfobject.1-1-1.min.js"></script>
<script>
$(document).ready(function() {
//
$("#popupclose").click(function () {
$("#popup").Hide();
$('.media').flash().remove();
return false;
});
//
$("a[href*='\.swf']").each(function(){
this.onclick = function(){
var filetoopen = $(this).attr("href");
$("#popup").Show;
$('.media').flash({swf:filetoopen,height:600,width:1000});
return false;
};
});
//
});
</script>
<style type="text/css">
#popup{
display:none;
position:absolute;
top: 10px;
left: 10px;
background:#FFFFFF;
border:2px solid #cecece;
z-index:2;
font-size:12px;
}
</style>
<div id="popup">
<a id="popupclose" href="javascript:void()">close</a>
<br/>
<div class="media" style="vertical-align:top;"></div>
</div>
Comments are closed.