2012-02-15 3 views
0

나는 http://fremont.alchemycs.com에서 WordPress 사이트를 개발 중이며 계속 jQuery 문제가 발생합니다. jQuery를 사용하는 페이지에는 페이지 상단에 슬라이드 쇼가 있고 사이드 바에 아코디언 메뉴가있는 두 가지 기능이 있습니다. 웬일인지, 나는 그들을 양쪽 다 일하게 할 수 없다. jQuery를로드하는 위치에 따라 "함수가 아닙니다"오류가 발생합니다. 위에서 내 헤더 경우jQuery 로딩 문제

<!DOCTYPE html> 
<html dir="ltr" lang="en-US"> 
<head> 
<meta charset="UTF-8" /> 
<meta name="viewport" content="initial-scale=1.0, width=device-width" /> 
<title>Fremont, Seattle</title> 
<link rel="profile" href="http://gmpg.org/xfn/11" /> 
<link rel="stylesheet" type="text/css" media="all" href="http://fremont.alchemycs.com/wp-content/themes/center/style.css" /> 
<link rel="pingback" href="http://fremont.alchemycs.com/xmlrpc.php" /> 
<!-- 
<script src="http://fremont.alchemycs.com/wp-content/themes/center/js/modernizr-1.6.min.js"></script> 
--> 
<link rel="alternate" type="application/rss+xml" title="Fremont, Seattle &raquo; Feed" href="http://fremont.alchemycs.com/feed/" /> 
<link rel="alternate" type="application/rss+xml" title="Fremont, Seattle &raquo; Comments Feed" href="http://fremont.alchemycs.com/comments/feed/" /> 
<link rel="alternate" type="application/rss+xml" title="Fremont, Seattle &raquo; Home Comments Feed" href="http://fremont.alchemycs.com/home/feed/" /> 
<link rel='stylesheet' id='ccf_custom-css' href='http://fremont.alchemycs.com/wp-content/plugins/constant-contact-form/class/ccf_custom.css?ver=3.2.1' type='text/css' media='screen' /> 
<link rel='stylesheet' id='contact-form-7-css' href='http://fremont.alchemycs.com/wp-content/plugins/contact-form-7/styles.css?ver=3.1' type='text/css' media='all' /> 
<link rel='stylesheet' id='amr-ical-events-list-css' href='http://fremont.alchemycs.com/wp-content/plugins/amr-ical-events-list/css/icallist.css?ver=1' type='text/css' media='all' /> 

<link rel='stylesheet' id='amr-ical-events-list_print-css' href='http://fremont.alchemycs.com/wp-content/plugins/amr-ical-events-list/css/icalprint.css?ver=1' type='text/css' media='print' /> 
<script type='text/javascript' src='http://fremont.alchemycs.com/wp-includes/js/l10n.js?ver=20101110'></script> 
<script type='text/javascript' src='http://fremont.alchemycs.com/wp-content/plugins/constant-contact-form/class/ccf_ajax.js?ver=3.2.1'></script> 
<script type='text/javascript' src='http://fremont.alchemycs.com/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script> 
<script type='text/javascript' src='http://fremont.alchemycs.com/wp-content/plugins/jquery-vertical-accordion-menu/js/jquery.hoverIntent.minified.js?ver=3.2.1'></script> 
<script type='text/javascript' src='http://fremont.alchemycs.com/wp-content/plugins/jquery-vertical-accordion-menu/js/jquery.cookie.js?ver=3.2.1'></script> 
<script type='text/javascript' src='http://fremont.alchemycs.com/wp-content/plugins/jquery-vertical-accordion-menu/js/jquery.dcjqaccordion.2.9.js?ver=3.2.1'></script> 
<script type='text/javascript' src='http://fremont.alchemycs.com/wp-includes/js/comment-reply.js?ver=20090102'></script> 
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://fremont.alchemycs.com/xmlrpc.php?rsd" /> 
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://fremont.alchemycs.com/wp-includes/wlwmanifest.xml" /> 

<link rel='index' title='Fremont, Seattle' href='http://fremont.alchemycs.com/' /> 
<link rel='next' title='Calendar' href='http://fremont.alchemycs.com/events/' /> 
<meta name="generator" content="WordPress 3.2.1" /> 

<!-- All in One SEO Pack 1.6.13.8 by Michael Torbert of Semper Fi Web Designob_start_detected [-1,-1] --> 
<meta name="description" content="The Center of the Universe" /> 
<link rel="canonical" href="http://fremont.alchemycs.com/" /> 
<!-- /all in one seo pack --> 
<link rel="stylesheet" type="text/css" href="http://fremont.alchemycs.com/wp-content/plugins/social-media-widget/social_widget.css" /> 
<link rel='stylesheet' id='wop-css' href='http://fremont.alchemycs.com/wp-content/plugins/widgets-on-pages/wop.css' type='text/css' media='all' /><!-- BEGIN Hackadelic Sliding Notes 1.6.5 --> 
<style type="text/css"> 
.concealed { display: none } 
.block { display: block } 
</style> 
<!-- END Hackadelic Sliding Notes 1.6.5 --> 

    <script src="http://fremont.alchemycs.com/wp-content/themes/center/js/jquery.flexslider.js"></script> 

    <link rel="stylesheet" type="text/css" media="all" href="http://fremont.alchemycs.com/wp-content/themes/center/css/flexslider.css" /> 
    <script type="text/javascript" charset="utf-8"> 
     $(window).load(function() { 
     $('.flexslider').flexslider(); 
     }); 
    </script> 

</head> 

, 나는 오류 메시지가 : 여기

는 순간에 서 나의 헤더 인 $ 함수

되지하지만 헤더를 변경하는 경우 나중에 jQuery를 헤더에로드하려면 아코디언 메뉴 기능에 대한 유사한 오류가 표시됩니다.

이것은 아마도 간단 할 수도 있지만 문제를 파악하는 데 어려움이 있습니다.

감사합니다.

EDIT - 내가 jQuery를로드하는 곳을 실험 해본 결과, 머리말의 맨 위에있는 방식으로 작업을 진행 했으므로 맨 처음에 하나의 스크립트 만 작동한다는 점을 강조하겠습니다.

답변

0

당신이 JQuery와 코어로드 확인 먼저. 어떤 이 라인

<script type='text/javascript' src='http://fremont.alchemycs.com/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script> 

첫 번째 스크립트 태그되어야한다는 것을 의미한다.

+0

지금 jQuery는 플러그인이있는 곳입니다. 그러나이 작업을 시도하기 위해 플러그인의 jQuery 호출을 제거하고 jQuery를 헤더의 맨 위에 올렸다. 나는 여전히 같은 문제를 안고있다. 페이지의 jQuery 함수 중 하나만 작동했다. – Gwendydd

+0

Tuncay Demirtepe가 말한 것처럼, $ jQuery 대신 $ jQuery가 사용됩니다. 어떤 이유로 jQuery 버전이 올바르지 않습니다. http://code.jquery.com/jquery-1.6.1.min.js '를 페이지에 모두 포함하면 올바르지 않습니다. 괜찮습니다. jQuery (window) ....를 사용하거나 파일을 올바른 버전 – Qurben

+0

으로 덮어 씁니다. jQuery 코어가 jQuery와 관련이없는 파일이 실제로 올바른 순서로 존재했습니다. – Qurben

0

당신은 순서가 중요합니까의 jquery.js 먼저 다음 jQuery를 사용하는 플러그인 js 파일의 나머지 부분을 포함하고 준비 핸들러 내부의 jQuery 코드를 포장해야

$(function(){ 
// 
}); 
0

당신은 당신이 최신 JQuery와 버전 (1.7.1)

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

에 구글 LIB 참조를 사용할 수 있습니다

<script type='text/javascript' src='http://fremont.alchemycs.com/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script> 

대신 다른 플러그인 위를 jQuery 코드 참조 을 추가해야합니다 사용자에게 다운로드 시간을 향상시켜야합니다 (첫 번째 스크립트 태그 여야합니다).

+0

내가 Qurben에게 말했던 것처럼, 나는 이것을했다. jQuery를 페이지 상단에 올렸지 만 여전히 페이지의 jQuery 함수 중 하나만이 작동했다. 다른 일이 여기에 있어야합니다. – Gwendydd