모듈에 내 사이트에 사용자 정의 jQuery 아코디언 메뉴가 있습니다. 모드가 활성화되어 있으면 RokSlideshow 모듈이 손상됩니다.Joomla, jQuery 모듈이 충돌 함
나는 둘 다 동시에 일할 수 없습니다.
이 사이트는 http://www.fbcsheffield.org/2.0
어떤 도움이 많이 주시면 감사하겠습니다입니다!
모듈에 내 사이트에 사용자 정의 jQuery 아코디언 메뉴가 있습니다. 모드가 활성화되어 있으면 RokSlideshow 모듈이 손상됩니다.Joomla, jQuery 모듈이 충돌 함
나는 둘 다 동시에 일할 수 없습니다.
이 사이트는 http://www.fbcsheffield.org/2.0
어떤 도움이 많이 주시면 감사하겠습니다입니다!
무언가 도구와 jquery가 충돌합니다. jquery 슬라이드 쇼 모듈을 사용하는 것이 좋습니다 - 가장 쉬운 방법입니다.
편집 : 그들은 같은 네임 스페이스를 사용하고,하지만 난
가 먼저로드 Mootools의를 강제로 사용 깊은 세부 사항에 갈 시간이별로 없어 같은 충돌이 보인다 그런 다음 jQuery를로드하고 앞에 No Conflict 모드로 들어가서의 jQuery 코드 나 플러그인이 실행되도록하십시오. 그냥 jQuery.noConflict()가 라고 있는지 확인해야합니다, 당신은 실제로 하지 처음 Mootools의로드해야합니까 : http://forum.joomla.org/viewtopic.php?f=231&t=283215
편집 : 줌라 포럼에 http://www.packtpub.com/files/learning-joomla-1-5-extension-development-sample-chapter-8-using-javascript-effects.pdf 또는 스레드 :이 페이지 183을 확인 즉시 jQuery를로드 한 후 : http://www.designvsdevelop.com/jquery-in-joomla-i-was-wrong
Joomla가 ob_start()를 사용하여 모든 내용을 버퍼링합니다. 당신과 함께 현재의 버퍼를 얻을 수 있습니다 :
$body = JResponse::getBody();
그런 다음 JQuery와 및 Mootools의 스크립트 선언을 발견하고 "onAfterRender"이벤트를 사용하여 시스템 플러그인에서 그들을 재구성 할 수 있습니다.
preg_replace()를 사용하여 JQuery를 가져 와서 MooTools 뒤에 넣을 수 있습니다. 그런 다음 JQuery에서 no conflict 모드를 활성화 할 수 있습니다. 여기
jQuery.noConflict();
1.1 내지 1.2로 변경 Mootools의 일례 플러그인. JQuery의 충돌 모드가 아닌 다른 방법을 사용할 수 있습니다.
<?php
/**
* MooTools1.2 w/ 1.1 compat for AjaxChat
* @copyright www.fijiwebdesign.com
* @author [email protected]
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
// included only
defined('_JEXEC') or die('Direct Access to this location is not allowed!');
jimport('joomla.plugin.plugin');
/**
* Joomla PHP Speedy Integration
*
* @author [email protected]
*/
class plgSystemAjaxchat extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args (void) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function plgSystemAjaxchat(& $subject, $config)
{
parent::__construct($subject, $config);
$mainframe =& JFactory::getApplication();
$document =& JFactory::getDocument();
$doctype = $document->getType();
// deactivate for backend
if ($mainframe->isAdmin()) {
return false;
}
// add mootools 1.2
if ($doctype == 'html') {
$document->addScript('components/com_ajaxchat/js/mootools-1.2-core.js');
$document->addScript('components/com_ajaxchat/js/mootools-1.2-more.js');
$document->addScript('components/com_ajaxchat/js/mootools-1.2-core-compat.js');
$document->addScript('components/com_ajaxchat/js/mootools-1.2-more-compat.js');
}
}
/**
* After Templte output is in buffer
*/
function onAfterRender() {
$mainframe =& JFactory::getApplication();
$document =& JFactory::getDocument();
$doctype = $document->getType();
// deactivate for backend
if ($mainframe->isAdmin()) {
return false;
}
// Only render for HTML output
if ($doctype !== 'html') {
return;
}
// get the output buffer
$body = JResponse::getBody();
// remove mootools if not needed
if (stristr($body, 'mootools.js') || stristr($body, 'mootools-uncompressed.js')) {
$body = preg_replace("/<script.*?mootools(-uncompressed)?\.js.*?<\/script>/i", '', $body);
} else {
$body = preg_replace("/<script.*?mootools-1\.2\-.*?\.js.*?<\/script>[\s\t\r\n]*/i", "\n", $body);
}
JResponse::setBody($body);
}
}
?>