脚本未在首页上执行

问题描述

| 我正在使用以下代码来评估我正在构建的网站上CMS生成的导航列表中的两组条件: 条件一:如果导航中有“&”号,请用em标记将其包围。
//pretty ampersands for all! Well,just the H1 tags and the navigation.
           $(\"nav a:contains(\'&\'),h1:contains(\'&\'),nav li:contains(\'&\')\",document.body)
                .contents()
                .each(
                    function() {
                        if( this.nodeType == 3 ) {
                            $(this)
                                .replaceWith( this
                                    .nodeValue
                                    .replace( /&/g,\"<em>&</em>\" )
                                );
                        }
                    }
            );
条件二:如果li或元素中的字符数超过20个字符,请对文本进行换行,以使设置为悬停时显示的图像不会跳到下一行。
                //if a submenu link is more than 20 characters long,resize that baby so the hover leaf won\'t jump.                                 
            $(\'nav li ul li a,.active\').each(function() {
                var curr = $(this).text().length;
                if(curr >= 20){
                    $(this).css({\'width\':\'90px\',\'text-indent\':\'-1em\',\'margin-left\':\'1em\'});
                }
            });
出于显而易见的原因,这些条件都不在首页上进行测试或执行。该脚本可以在所有内部页面上正常工作。 (尽管在IE7中不是,但出于我尚未弄清的原因)我看不到单独页面上的代码之间的任何差异,这可以解释这种差异。救命? 可以在此处查看实时站点。     

解决方法

        在Firebug中,首页上存在很多此类错误:
a.panelSize[b] is undefined
(function(c){c.anythingSlider=function...&a.gotoPage(b,false,i)}})}})(jQuery);           
http://www.qualprnt.com/clients/smca/js/jquery.anythingslider.min.js (Line 8)
您的其他页面未加载
jquery.anythingslider.min.js
。我会在那里检查。如果使用脚本的最小版本,则调试起来可能会更容易。     

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...