开发者

Script not executing on homepage

I'm using the following code to eval开发者_Python百科uate two sets of conditions in a CMS generated navigation list on a site I'm building:

Condition one: if there's an ampersand in the navigation, surround it with em tags.

//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>" )
                                );
                        }
                    }
            );

Condition two: if the number of characters in a li or a element exceed 20 characters, wrap the text so that the image set to display on hover and after won't jump to the next line.

                //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'});
                }
            });

For no apparent reason, neither of these conditions are being tested for or executed on the homepage. The script work fine on all interior pages. (though not in IE7, for reasons I have yet to figure out) I can't see any difference between the code on the separate pages that would account for this disparity. Help?

The live site can be viewed here.


In firebug, there's a lot of these errors on the home page:

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)

Your other pages don't load jquery.anythingslider.min.js. I would check there. It might be easier to debug if you used unminimized versions of the scripts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜