Jump to content

Issues with Fancybox


Recommended Posts

Hi,

 

I'm trying to add a custom link in header of my website which would open a CMS page in Fancybox upon click.

 

I've added this to my header.tpl

 

first these lines in <head>:

 

<script type="text/javascript" src="/js/jquery/plugins/fancybox/jquery.fancybox.js"></script>
<script type="text/javascript">
{literal}
 $( document ).ready(function() {
  $('a.iframe').fancybox();
 });
{/literal}
</script>

 
    <script type="text/javascript">
    $('a.iframe').fancybox();
    $( document ).ready(function() {
    $(".iframe").fancybox({
    autoSize: false,
    autoDimensions: false,
    width: 630,
    height: 425,
    fitToView: false,
    padding: 0,
    title: this.title,
    href: $(this).attr('href'),
    type: 'iframe'
    });});
     
    </script>

 

 

after <head> i've added something like this:

 

<a href="http://mysite.com/co...?content_only=1" class="iframe">

 

But in result the new page is opened instead of creating a fancy box on current page. What have I done wrong?

I've cleared and disabled all cache but even this did not help. The fancybox library is surely installed as it can be opened by clicking /js/jquery/plugins/fancybox/jquery.fancybox.js link.

 

The strange thing is I've just repeated the same actions as on my another website with other template and there it worked perfectly.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...