I'm using FaceBox in an ASP.net project. It works great when I call it from a hard-coded script block in the ASPX page like this:
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({
loadingImage: '../../CSS/FaceBox/Images/loading.gif',
closeImage: '../../CSS/FaceBox/Images/closelabel.png'
})
});
</script>
However, when I move that code into code behind so that I can first execute some server side code, the box opens great but the images are no longer displayed (the missing image icon is displayed instead. Clicking the icon does work.). Here's the code I'm using:
Dim sbClientScript As System.Text.StringBuilder = New System.Text.StringBuilder()
sbClientScript.AppendLine("<script type='text/javascript'>")
sbClientScript.AppendLine(" jQuery.facebox({ ")
sbClientScript.AppendLine(" ajax: 'EditQuestion.aspx', ")
sbClientScript.AppendLine(" loadingImage: '../../CSS/FaceBox/Images/loading.gif', ")
sbClientScript.AppendLine(" closeImage: '../../CSS/FaceBox/Images/closelabel.png' ")
sbClientScript.AppendLine(" }); ")
sbClientScript.AppendLine("</script>")
If Not Page.ClientScript.IsStartupScriptRegistered("skFacebox") Then
Page.ClientScript.RegisterStartupScript(Me.GetType(), "skFacebox", sbClientScript.ToString())
End If
I've tried changing the order of the parameters (putting "ajax" last). I've tried splitting things out into different functions. I've tried setting the loadingImage and closeImage in a hard coded script block. Nothing is working.
Anyone know the correct syntax to set the image parameters?
Thanks!