0

I have a problem that my jQuery don't load or something when i'm on the contentpages.

When i click on the link that should load the jquery, it only works at my startpage (Default.aspx). And when i click at the same link that is placed in my footer on any other contentpage, nothing happens. So i guess something is wrong with the paths or the loading of my scripts.

I'm not so familiar with jQuery so hopefully someone can help me.

Here is my scripts in the masterpage .

<script type="text/javascript" src="../fancybox/jquery.fancybox-1.3.4.pack.js"</script>

<link href="../fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">

    $(document).ready(function () {

        $(".inline").fancybox({
            'hideOnContentClick': true,
            'titlePosition': 'inside',
            'transitionIn': 'none',
            'transitionOut': 'none'
        });

    });
</script>

And this is what it calls, the footer in my masterpage.

<div id="footer"><a class="inline" href="#data">Viktor Nilsson</a></div>

<div style="display:none">
<div id="data">
Kontakta Viktor Nilsson<br />
Tel: 00000<br />
Email: aaa@hello.com <br /><br /> 
</div></div>    
Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
  • 1
    Worth checking using firebug (firefox) or similar to see if there are any script errors being thrown. – Davos555 May 16 '12 at 13:11

1 Answers1

0

You link the script files using ../fancybox/etc : this relative path could be wrong when opening a content page. Let's say your master is in the root folder and you content page is in a Content folder

webroot    
   |
   |-Master.aspx
   |-Content
   |    L contentPage.aspx
   L fancybox

the script should become ../../fancybox/etc...

For this reason, you'd better use

<script src='<%= Page.ResolveUrl("~/fancybox/jquery.fancybox-1.3.4.pack.js")%>' type="text/javascript"></script>

The same for the css link

themarcuz
  • 2,573
  • 6
  • 36
  • 53
  • I have tried this but still not working, i have all my pages in the same folder include the masterpage. I dont understand why it's working on the Default.aspx but not any other contentpage. – Viktor Nilsson May 16 '12 at 14:35