Affan Pathan
Affan Pathan

Reputation: 308

fancybox not working in div tag

I am facing one problem with fancybox loading. I have following page layout: enter image description here

I have written code for including jquery.fancybox-1.2.6.js and jquery.fancybox-1.2.6.css in browse.php file as well as CSS for fancybox (suggest me if I have included in wrong file instead of explorer.php)

$(".view_details").fancybox( {
                    'overlayOpacity' : 0.1,
                    'showCloseButton' : true,
                    'frameHeight' : 250,
                    'frameWidth' : 300,
                    'hideOnContentClick':false,
                    'centerOnScroll' : false
                });

, Now browse.php is loaded each time when user click on link in DIV 1 pane.

In browse.php I am calling fancybox on a link,

<a class="view_details" href="file.php?par=1" >View Details </a>

But Its not working, sometime its open at very first time and then onwards showing error that TypeError: loading is undefined. Please help me in this situation.

Thanks in advance.

Upvotes: 1

Views: 583

Answers (1)

Bhavik Patel
Bhavik Patel

Reputation: 789

You can do one thing

First I realize that DIV tag bind with the parent container (Like parent page which contains DIV tag), so sometime JavaScript and CSS dont bind with DOM component.

Second , I have relace DIV with IFRAME and now its working good as per desire. The reason I have noticed that IFRAME treat its inner source as different page and load whole page as another window object like we do with window.open(). So Javascript and CSS binds perfectly in it.

I have replace:

<div id="file_list" style="float: left;width: 80%;overflow: auto"></div>

with

<iframe id="doc_list" name="doc_list" style="height: 500px;width: 98%;border: 0px"></iframe>

And set desire page as SRC to IFRAME while clicking on folder in left DIV 1 pane.

document.getElementById("doc_list").src = "desire_page.php";

Cheers!

Upvotes: 1

Related Questions