2

I am using asp.net 4.0. i am creating the Url with the help of "routes.MapPageRoute".

so i noticed that jquery file was not gettin loaded due to url not being static. so i used "ResolveClientUrl". I could load the js files but in jquery code i get error.

I did ask this same question on http://forums.asp.net/t/1680184.aspx/1?Jquery+Error+Object+Doesn+t+support+this+method+or+property+

I have given the image for the error also.. please anyone can guide me where am i going wrong.

I somehow feel that i have issue due to the pattern i am writting url in global file.

Code:

<asp:Content ID="content1" runat="server" ContentPlaceHolderID="HeadContent">
    <link href="../js/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />
     <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.js" type="text/javascript"></script>
     <script src='<%=ResolveClientUrl("~/js/fancybox/jquery.fancybox-1.3.4.js")%>' type="text/javascript"></script>
     <script src='<%=ResolveClientUrl("~/js/fancybox/jquery.easing-1.3.pack.js")%>' type="text/javascript"></script>
     <script src='<%=ResolveClientUrl("~/js/fancybox/jquery.mousewheel-3.0.4.pack.js")%>' type="text/javascript"></script>
    <script type="text/javascript">
        $.noConflict();
        $(document).ready(function () {
            $(".fancyYoutube").fancybox({
                'transitionIn': 'elastic',
                'transitionOut': 'fade',
                'width': 680,
                'height': 495,
                'type': 'swf'
            });
        });
    </script>
</asp:Content>

Error:
enter image description here

2
  • 1
    Please post all the relevant content and code here instead of referencing to an external forum, for legacy purposes ;) Commented May 15, 2011 at 9:22
  • I have added it myself from the other place.. @Abhishek please update if you have different code (as suggested by Majid) now. Commented May 15, 2011 at 12:43

2 Answers 2

2

You need to remove $.noConflict(); from the beginning of code; or if you want to keep it, you should not use $ in the lines following it:

Solution 1:

// $.noConflict(); <-- comment or remove this line
$(document).ready(function () {
  $(".fancyYoutube").fancybox({
    'transitionIn': 'elastic',
    'transitionOut': 'fade',
    'width': 680,
    'height': 495,
    'type': 'swf'
  });
});

Solution 2:

$.noConflict();
jQuery(document).ready(function () {
  jQuery(".fancyYoutube").fancybox({
    'transitionIn': 'elastic',
    'transitionOut': 'fade',
    'width': 680,
    'height': 495,
    'type': 'swf'
  });
});

Explanation:
As the docs say, you use $.noConflict() to tell jQuery do not use $ and let other libraries use it. Here you have no other library, so you don't need to relinquish jQuery's control of the $ variable, so both solutions should work for you.

Sign up to request clarification or add additional context in comments.

10 Comments

ya i have not posted the code. it was giving me error so only i have removed the code of that page.
So what remains to check? 'Here used to be buggy code which I removed, could you tell me what was wrong with it?'?
ok.. Now i uploaded the page with code.. :-) i had just removed the code as that part was not working. Now can you please guide me?
That did solve the problem. but now i am getting error in fancybox js file. The error is _show = function() { var pos, equal; loading.hide(); if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) { $.event.trigger('fancybox-cancel'); busy = false; return; } in the line if(wrap.is.... same error as object not supported. what could be reason for this error...it is same js file which works fine with other page.
@shadow: that solved the problem but i am getting error in js file now
|
1

I had the same problem.

check out that in css file all src path are correct:

for example, this line has a src worng with regard to my web tree:

.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='**fancybox/**fancy_shadow_n.png', sizingMethod='scale'); }

Also check that css file is loading correctly. Use the debug option in your browser you check it out.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.