单击功能的Javascript无法在一个页面上运行

时间:2012-11-09 21:10:57

标签: jquery

这里的想法是,无论何时用户点击图像,他或她都可以在上面的框中查看有关该人的信息。它之前工作,然后突然停止了。这是我正在谈论的页面和我的代码的链接。

http://www.team3550.org/team/

代码:

    <script type="text/javascript">
        jQuery(document).ready(function($){
            $('#team_pics img, #team_pics2 img').click(function(){
                $('#team_description').html('<img src="' + $(this).attr('src') + '" />' + $(this).next().html());
            });
        });
    </script>
        <div id="team_description">     
            <h1>Click on a picture below to learn more about a team member</h1>
        </div>
        <div id="team_container">
            <div id="team_pics">
                <img src="<? bloginfo('stylesheet_directory'); ?>/images/pixel_chase.png" width="100px" height="100px" style="padding: 30px;"/>
                <div class="caption"><p class="caption_paragraph"><span class="caption_header"><b>Chase Schweitzer</b></span><br>-Third year in FTC<br>-Designer, builder, webmaster<br>-Interests: programming (HTML, CSS, BASIC, Javascript, etc.), web design, music, writing<br>-Plays the guitar and violin</p></div>
                <img src="<? bloginfo('stylesheet_directory'); ?>/images/pixel_annie.png" width="100px" height="100px" style="padding: 30px;"/>
                <div class="caption"><p class="caption_paragraph"><span class="caption_header"><b>Annie Howard</b></span><br>-Second year in FTC<br>-Designer, builder, writer<br>-Interests: music, writing, history, anthropology<br>-Plays the ukelele, sings</p></div>
                <img src="<? bloginfo('stylesheet_directory'); ?>/images/pixel_tanvi.png" width="100px"height="100px" style="padding: 30px;"/>
                <div class="caption"><p class="caption_paragraph"><span class="caption_header"><b>Tanvi Yenna</b></span><br>-Second year in FTC<br>-Designer, builder, engineering notebook organizer<br>-Interests: designing, music, writing, and acting<br>-Plays the piano, guitar and ukelele; sings</p></div>
                <img src="<? bloginfo('stylesheet_directory'); ?>/images/pixel_jordan.png" width="100px" height="100px" style="padding: 30px;"/>                
                <div class="caption"><p class="caption_paragraph"><span class="caption_header"><b>Jordan Burklund</b></span><br>-Fourth year in FTC, two years in FLL<br>-Designer, builder, programmer<br>-Interests: robotics/mechatronics engineering, aviation, and music<br>-CLAD certified</p></div>              
            </div>
            <div id="team_pics2">                   
                <img src="<? bloginfo('stylesheet_directory'); ?>/images/pixel_saketh.png" width="100px" height="100px" style="padding: 0px 30px;"/>        
                <div class="caption"><p class="caption_paragraph"><span class="caption_header"><b>Saketh Undurty</b></span><br>-Fourth year in FTC, two years in FLL<br>-Designer, builder<br>-Interests: 3D modeling/design, architecture, and music<br>-Plays trumpet in concert band and jazz orchestra</p></div>
                <img src="<? bloginfo('stylesheet_directory'); ?>/images/pixel_daniel.png" width="100px" height="100px" style="padding: 0px 30px;"/>
                <div class="caption"><p class="caption_paragraph"><span class="caption_header"><b>Daniel Miller</b></span><br>-Third year in FTC<br>-Designer, builder, promotions<br>-Interests: architecture, graphic design, music<br>-Viola player, mime, and thespian</p></div>
                <img src="<? bloginfo('stylesheet_directory'); ?>/images/pixel_sidd.png" width="100px" height="100px" style="padding: 0px 30px;"/>
                <div class="caption"><p class="caption_paragraph"><span class="caption_header"><b>Sidd Somayajula</b></span><br>-Third year in FTC<br>-Designer, builder, webmaster<br>-Interests: medicine, math, web design, programming (HTML, CSS, BASIC, Javascript, etc.)<br>-Plays tennis</p></div>
            </div>
        </div>

2 个答案:

答案 0 :(得分:1)

您确实看到第202行如何抛出TypeError,对吗?

var top = $('#blog_right').offset().top - parseFloat($('#blog_right').css('margin-top').replace(/auto/,0));

未捕获的TypeError:无法读取未定义的属性“top”

我在这个页面上看不到任何带有blog_right的元素作为ID。

答案 1 :(得分:0)

jQuery(document).ready(function($){电话的代码中设置断点甚至都不会停止。