How do you set iframe height/width in fancybox V2?
-
I have been using Fancybox 1.3.4, and right there I have the dimensions of the iframe in the link itself. Here is an example of how I have it test.html?width=675&height=470 When I click on the link fancybox will open the iframe with those dimensions. I am trying Fancybox V2, but I'm confused on how to set the dimensions for the iframes. I want every iframe to have different dimensions. How would I do it?
-
Answer:
Set your html (with HTML5 DOCTYPE) like this: <a class="fancybox fancybox.iframe" data-width="675" data-height="470" href="test.html" >test</a> <a class="fancybox fancybox.iframe" data-width="400" data-height="200" href="test2.html" >test 2</a> (set width and height on the data- attributes for each element) then this script: $("a.fancybox").fancybox({ fitToView: false, afterLoad: function(){ this.width = $(this.element).data("width"); this.height = $(this.element).data("height"); } }); // fancybox should do the trick in fancybox v2.x
Guillermo Moreno at Stack Overflow Visit the source
Related Q & A:
- How can mobile browser change screen width?Best solution by stackoverflow.com
- How do you check your height accurately without the doctor?Best solution by Yahoo! Answers
- How can I boost my height?Best solution by Yahoo! Answers
- How can I increase my height?Best solution by Yahoo! Answers
- How do you find the height of a trapezoid?Best solution by eHow old
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.