Fancybox open a text file?

I wanted to create a website where I can view some types of FancyBox files, such as images, text documents, etc.

Performing this action:

$(".text").fancybox(); <a class="text" href="document.css" title="document.css"><img src="files.png"/>OPEN ME</a> 

It opens a document, but it does not respect the fields and format of the document, I mean that everything is written on one line, so I assume that it will open it as if it were HTML, and not as a text editor.

So does anyone, how to open it, for example, in Notepad ++ or GEdit, open it?

Thanks!

+4
source share
1 answer

For most text files, you may need to open them with an iframe so that you can save the format, then your link should look like this:

 <a class="text fancybox.iframe" href="http://fancyapps.com/fancybox/source/jquery.fancybox.css">open css file</a> 

... pay attention to the special fancybox.iframe class. Then your code is as simple as:

 $(".text").fancybox();​ 

See DEMO

For more information on how to select fancybox type content, check out: fooobar.com/questions/375743 /.

+3
source

All Articles