Lisa23 Posted March 13, 2012 Share Posted March 13, 2012 Hi i have a site which a use a slideshow which has its own js files to work and a jquery tabs which also has its own js files, but now since i had both those src files into the head of my page only one works, it seems i cant have both src files. I have googled about the jquery conflict function but i just dont think i can get the sintax correct can someone help me out please? thanks in advance I've separated the files with html coment ofr better visual the files i need are SLIDESHOW files, and TABS file. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>People Smart Learning</title> <link rel="stylesheet" type="text/css" href="stylesheets/main.css" /> <link rel='stylesheet' id='style-css' href='slide-show/diapo.css' type='text/css' media='all'> <link type="text/css" href="js/jquery-ui-1.8.18.custom.css" rel="stylesheet" /> <meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE" /> <!-- START SLIDESHOW FILES --> <script type='text/javascript' src='slide-show/scripts/jquery.min.js'></script> <!--[if !IE]><!--><script type='text/javascript' src='slide-show/scripts/jquery.mobile-1.0rc2.customized.min.js'></script><!--<![endif]--> <script type='text/javascript' src='slide-show/scripts/jquery.easing.1.3.js'></script> <script type='text/javascript' src='slide-show/scripts/jquery.hoverIntent.minified.js'></script> <script type='text/javascript' src='slide-show/scripts/diapo.js'></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js"></script> <script> $(function(){ $('.pix_diapo').diapo(); }); </script> <!-- END SLIDESHOW FILES FOR --> <!-- START CONTACT FORM FILES --> <script type="text/javascript" src="form/validation/validation.js"></script> <script type="text/javascript"> var nameError = '<?php echo $error_messages['fullname']; ?>'; var emailError = '<?php echo $error_messages['email']; ?>'; var telephoneError = '<?php echo $error_messages['telephone']; ?>'; var commentError = '<?php echo $error_messages['comment']; ?>'; </script> <!-- START CONTACT FORM FILES --> <!--START TAB FILES--> <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript"> $(function(){ // Tabs $('#tabs').tabs(); }); </script> <!-- END TABS FILES --> </head> Quote Link to comment https://forums.phpfreaks.com/topic/258865-i-think-i-have-jquery-conflict-problem-help-please/ Share on other sites More sharing options...
Adam Posted March 14, 2012 Share Posted March 14, 2012 I would strongly encourage you to stick to just one framework. Generally JS frameworks internally contain the same stuff, so you're just doubling the resources needed for no good reason. If you still want to go ahead for whatever reason, then you'll need to use jQuery.noConflict() (or the mootools equivalent) to remove the global $ alias variable, as both frameworks by default use this as a shorthand. You'll then need to invoke jQuery using jQuery, instead of $. For example: $('...'); Would become: jQuery('...'); However using $ does speed up development a bit and keep your code cleaner, so you could use an 'immediate function' with a local-only $ alias instead: (function($) { // Normal $ jQuery calls here })(jQuery); jQuery also supports this in the .ready() event: jQuery(document).ready(function($) { // Normal $ jQuery calls here }); Quote Link to comment https://forums.phpfreaks.com/topic/258865-i-think-i-have-jquery-conflict-problem-help-please/#findComment-1327280 Share on other sites More sharing options...
Lisa23 Posted March 14, 2012 Author Share Posted March 14, 2012 Hi thanks for the help, i managed to get to work with the conflict script, but like you said if i could use just one library source would do the job i would the problem is whenever i take one of those js files the function don't work, if you know which or how i can remove and just keep one js file i would appreciate the help, if you cant i still appreciate the help already thanks. Quote Link to comment https://forums.phpfreaks.com/topic/258865-i-think-i-have-jquery-conflict-problem-help-please/#findComment-1327441 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.