Calling lightbox - using inline data to show - jQuery FancyBox


On this site: - I am using this lightbox plugin:

At the bottom of that layout, there are three buttons. They open inline HTML in a lightbox. My code to call it is below in the code box.

The problem is, is that I have them all showing on click, you can see them display and a scrollbar is added on click.

Any suggestions I can do to make it more dynamic so it only loads the one being clicked?

At the end of the day, I would like to be able to show it without the others loading.

thank you!


I have also tried calling external HTML pages, but it sits there with the loading animation.

$(".load-content").fancybox({onStart:function(){$(".hide-data").show();},onCleanup:function(){$(".hide-data").hide()},'overlayOpacity': '.6','overlayColor':'#000000','titleShow': false});

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

the problem lies in the method you're calling the fancy box.

You're using a single call that shows all the .hide-data class then hides them, which affects all your elements because they all have the .hide-data css class

Alternatively try give each link an ID and write the fancybox for that ID

<li class="business-owner_off"><a id="BusinessOwner" href="#business-owner" class="load-content" onclick="javascript:pageTracker._trackPageview('/who-are-you/business-owner');"></a></li>

		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
catonthecouchproductionsAuthor Commented:
I thought of that, but I didnt want to have 7 extra lines, wasnt sure if there was a more dynamic way. But if that seems to be the way, I can go ahead with that.

Then each will open div X


Yes, each will open the div in the href.
It can still be implemented as dynamic but that would require detecting the related element and going through a loop of all the others with the same class setting their visibility to hidden.
I haven't done it that way before but the concept should be valid, it's just going to take much time and testing to make it work, and probably you'll still end with several lines of script which wouldn't be worth the effort unless you had a lot more than just 7
catonthecouchproductionsAuthor Commented:
Exactly, I just went ahead and made each line have its own ID/call.

Thank you!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.