Set a Dynamic Width / Height on Fancybox

298 views
Skip to first unread message

miasm666

unread,
Jul 22, 2010, 10:53:01 AM7/22/10
to fancybox
I know this has been talked about a couple of time, but all the
searchresults I found won´t do it for me. They just dont work!!!

The situation:
I need a way to dynamically specify the width and height in the URL’s
parameters for Fancybox iFrames!

This is what i found:

****************************************** SCRIPT
************************************************************
$('a.fb_dynamic').each(function(){
var dWidth = parseInt($(this).attr('href').match(/
width=[0-9]+/i)[0].replace('width=',''));
var dHeight = parseInt($(this).attr('href').match(/
height=[0-9]+/i)[0].replace('height=',''));
$(this).fancybox({
'width':dWidth,
'height':dHeight,
'autoScale' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'type' : 'iframe'
});
});
****************************************** END SCRIPT
**********************************************************

************************************************** URL
*************************************************************

<a class="fb_dynamic" href="http://darkcrimson.com/?
width=400&height=300">Link</a>

*********************************************** END URL
**********************************************************

The iFrame opens but i get an error Message within the iframe saying:
"Not Found - The requested URL /?width=400&height=300 was not found on
this server."
The dimension settings work though!

What can I do??? I am sitting on this for two days now and can´t get
it to work (no, I am not a programmer, I am a Printdesigner, so that
might be the cause, haha)

I hope someone can help since time is running out for me :(

Thanks!!



JFK

unread,
Jul 22, 2010, 12:33:18 PM7/22/10
to fancybox

miasm666

unread,
Jul 23, 2010, 7:50:39 AM7/23/10
to fancybox
thanks for the advise...

but its all kinda confusing to me...

"<li class="someclass {some: 'data'} anotherclass">...</li>

<script>alert($('li.someclass').metadata().some);</script>"

what is "someclass" and "().some"?

:/


On 22 Jul., 18:33, JFK <jfk.d...@gmail.com> wrote:
> see Janis commentshttp://groups.google.com/group/fancybox/browse_thread/thread/29617e0f...http://groups.google.com/group/fancybox/msg/ae544ce28a16ec87

JFK

unread,
Jul 23, 2010, 2:03:04 PM7/23/10
to fancybox
it means exactly what it means ;)

someclass means some class, any class you want ... and some means some
something
take this example
<a class="fancybox_swf {width:800,height:600}" href="...">...</a>

fancybox_swf would the "someclass" you are confused about, so is
arbitrary and you name the class the way you want
width and height would be the "some" and data is the value that both
width and height will get
().some means applying any other jQuery function to your selector, but
that is also optional

On Jul 23, 4:50 am, miasm666 <miasmat...@gmx.de> wrote:
> thanks for the advise...
>
> but its all kinda confusing to me...
>
> "<li class="someclass {some: 'data'} anotherclass">...</li>
>
> <script>alert($('li.someclass').metadata().some);</script>"
>
> what is "someclass" and "().some"?
>
> :/
>
> On 22 Jul., 18:33, JFK <jfk.d...@gmail.com> wrote:
>
> > see Janis commentshttp://groups.google.com/group/fancybox/browse_thread/thread/29617e0f...
>
Reply all
Reply to author
Forward
0 new messages