<ul> foreach(var video in mainVideos) { <li><a href="@video.videoUrl" class="iframe" width="@video.Width" height="@video.Height"></li> } </ul>
I realize that "width" and "height" has no meaning for anchors, but in this case, I'm just using them as attributes to hold numbers. For some reason, in the javascript, if I replace the attributes with the actual numbers, it works fine. But once I start using jquery to reference the dimensions, it does not read it. I know the numbers exist though, because when I alert($ (this).attr('height') ), it shows up.
Any help with this matter would be greatly appreciated.
Don't know a lot about jQuery. Could you post your example with hard coded values that works? Maybe I can see what's different. I used this a while back in Umbraco 5 for the Modal:
Fancybox iframe sizing
Hello:
I am trying to automatically set the width and height of the fancybox iframe to numbers inputted by user. Below is my code:
<script type="text/javascript">
$(function () {
$(".iframe").fancybox({
'width' : $(this).attr('width'),
'height' : $(this).attr('height')
});
});
</script>
<ul>
foreach(var video in mainVideos)
{
<li><a href="@video.videoUrl" class="iframe" width="@video.Width" height="@video.Height"></li>
}
</ul>
I realize that "width" and "height" has no meaning for anchors, but in this case, I'm just using them as attributes to hold numbers. For some reason, in the javascript, if I replace the attributes with the actual numbers, it works fine. But once I start using jquery to reference the dimensions, it does not read it. I know the numbers exist though, because when I alert($ (this).attr('height') ), it shows up.
Any help with this matter would be greatly appreciated.
Thank you for your time.
Sincerely,
Jeff
Don't know a lot about jQuery. Could you post your example with hard coded values that works? Maybe I can see what's different. I used this a while back in Umbraco 5 for the Modal:
Not the same but perhaps it can help you.
Jeroen
is working on a reply...