admin管理员组

文章数量:1305035

Why do I get this error from my overlay jquery code?

This is the code:

jQuery(document).ready(function($) {

    // if the function argument is given to overlay,
    // it is assumed to be the onBeforeLoad event listener
    $("a[rel]").overlay({

        mask: 'darkred',
        effect: 'apple',

        onBeforeLoad: function() {

            // grab wrapper element inside content
            var wrap = this.getOverlay().find(".contentWrap");

            // load the page specified in the trigger
            wrap.load(this.getTrigger().attr("href"));
        }

    });
});

This code is the overlay like this: .html

Halp?

ps. Sorry for my bad english.

Why do I get this error from my overlay jquery code?

This is the code:

jQuery(document).ready(function($) {

    // if the function argument is given to overlay,
    // it is assumed to be the onBeforeLoad event listener
    $("a[rel]").overlay({

        mask: 'darkred',
        effect: 'apple',

        onBeforeLoad: function() {

            // grab wrapper element inside content
            var wrap = this.getOverlay().find(".contentWrap");

            // load the page specified in the trigger
            wrap.load(this.getTrigger().attr("href"));
        }

    });
});

This code is the overlay like this: http://flowplayer/tools/demos/overlay/external.html

Halp?

ps. Sorry for my bad english.

Share Improve this question asked Dec 17, 2011 at 18:53 humanbeinghumanbeing 1212 gold badges3 silver badges12 bronze badges 2
  • This is not enough code to demonstrate you're doing this correctly. According to the link you gave there are multiple steps to set up the overlay. We don't know if you set it up correctly, could you give us more of the page and how you set it up? – EKet Commented Dec 17, 2011 at 19:24
  • This work perfectly in html but when i try to include this plugin into wordpress theme doesn't work. – humanbeing Commented Dec 17, 2011 at 19:53
Add a ment  | 

4 Answers 4

Reset to default 4

"Could not find Overlay: nofollow" is caused by using a non-specific css selector to find the links you want to attach your overlay to.

Including the javascript properly was the correct answer to the initial question... I came to this page based on the Overlay: nofollow issue in a ment.... since this is the first thing I found and didn't find an answer I wanted to ment here since I found it is caused by the css selector finding other uses of .. and there isn't a nofollow overlay...

assuming 'overlay' is the id of your div as in the following:

<!-- overlayed element -->
<div class="apple_overlay" id="overlay">
   < !-- the external content is loaded inside this tag -- >
   <div class="contentWrap"></div>

</div>

you should be doing something like:

 $("a[rel=#overlay]").overlay(

instead of:

 $("a[rel]").overlay(

You need to load the overlay plugin before jQuery will see it as part of the object; see below.
Note: the plugin must e after the jQuery script

<script src="http://ajax.googleapis./ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="http://cdn.jquerytools/1.2.6/all/jquery.tools.min.js"></script>

Got the same problem and found a really strange solution. I just included jquery.tools before jquery.ui in this way:

 <script src='js/jquery-1.4.2.min.js' type='text/javascript'></script>
 <script src='js/jquery.tools.min.js' type='text/javascript'></script>
 <script src='js/jquery-ui-1.7.2.custom.min.js' type='text/javascript'></script>

That's all. No idea why it works now but it does the job.

Did you include the overlay script src in your page?

本文标签: javascriptUncaught TypeError Object object Object has no method 39overlay39Stack Overflow