1

我基本上是在尝试遵循http://www.building58.com/examples/tabSlideOut.html教程,但我遇到了那个错误,问题是什么?

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>

<script src="http://tab-slide-out.googlecode.com/files/jquery.tabSlideOut.v1.3.js"></script>
<style type="text/css" media="screen">  
    .slide-out-div {
     padding: 20px;
     width: 250px;
     background: #f2f2f2;
     border: #29216d 2px solid;
     }
     </style>
            <script>
         $(function(){
             $('.slide-out-div').tabSlideOut({
                 tabHandle: '.handle',                              //class of the element that will be your tab
                 pathToTabImage: 'images/contact_tab.gif',          //path to the image for the tab (optionaly can be set using css)
                 imageHeight: '122px',                               //height of tab image
                 imageWidth: '40px',                               //width of tab image    
                 tabLocation: 'left',                               //side of screen where tab lives, top, right, bottom, or left
                 speed: 300,                                        //speed of animation
                 action: 'click',                                   //options: 'click' or 'hover', action to trigger animation
                 topPos: '200px',                                   //position from the top
                 fixedPosition: false                               //options: true makes it stick(fixed position) on scroll
             });
         });



         </script>
        <div class="slide-out-div">
        <a class="handle" href="http://link-for-non-js-users.html">Content</a>
        <h3>Contact me</h3>
        <p>Thanks for checking out my jQuery plugin, I hope you find this useful.
        </p>
        <p>This can be a form to submit feedback, or contact info</p>
    </div>

[04:54:57.945] TypeError: $(".slide-out-div").tabSlideOut 不是函数@

4

2 回答 2

3

如果您的浏览器中有调试器,大多数现代浏览器都会按 F12 进行检查,然后您可以查看所有脚本是否正确加载,并且typeof您可以使用该函数检查 tabSlideOut 是什么(未定义或函数)。

我想你是从这里复制粘贴的:http ://www.building58.com/examples/tabSlideOut.html 。您能否仔细检查您是否正确复制了所有内容,包括 css?

于 2012-09-13T11:14:25.553 回答
0

尝试使用

jQuery(function() {

});

而不是 $

于 2012-09-13T11:07:04.497 回答