Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Jquery + Motools (https://javascript.ru/forum/jquery/9045-jquery-motools.html)

alizid 26.04.2010 18:06

Jquery + Motools
 
Добрый день. Возникла проблема в работе 2 библиотек.
Хидер:
<script type="text/javascript" src="mootools.js"></script>
<script type="text/javascript" src="1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.flip.min.js"></script>
Далее идет вызов jquery в отдельном файле.
$(document).ready(function(){
	/* The following code is executed once the DOM is loaded */
	
	$('.sponsorFlip').bind("click",function(){
		
		// $(this) point to the clicked .sponsorFlip element (caching it in elem for speed):
		
		var elem = $(this);
		
		// data('flipped') is a flag we set when we flip the element:
		
		if(elem.data('flipped'))
		{
			// If the element has already been flipped, use the revertFlip method
			// defined by the plug-in to revert to the default state automatically:
			
			elem.revertFlip();
			
			// Unsetting the flag:
			elem.data('flipped',false)
		}
		else
		{
			// Using the flip method defined by the plugin:
			
			elem.flip({
				direction:'lr',
				speed: 350,
				onBefore: function(){
					// Insert the contents of the .sponsorData div (hidden from view with display:none)
					// into the clicked .sponsorFlip div before the flipping animation starts:
					
					elem.html(elem.siblings('.sponsorData').html());
				}
			});
			
			// Setting the flag:
			elem.data('flipped',true);
		}
	});
	
});

Как я понимаю они нужно вызов переделать под jQuery.noConflict(), не могли бы вы мне помочь?

Octane 26.04.2010 20:21

<!-- сначала -->
<script type="text/javascript" src="1.4.2/jquery.min.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>

<!-- а потом уже грузим что угодно -->
<script type="text/javascript" src="mootools.js"></script>
<script type="text/javascript" src="jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.flip.min.js"></script>


<script type="text/javascript">
(function ($) {

    // Здесь $ — функция jQuery

}(jQuery));
</script>


И да, два аналогичных фреймворка в одном документе — это 3,14здец.

alizid 26.04.2010 20:50

Но вот так к сожелению получается, так-как весь сайт на mootools-е а именно один элемент на jquery.


Часовой пояс GMT +3, время: 04:07.