BuildMyWeb Posted November 6, 2014 Share Posted November 6, 2014 i have two scripts i am using in one file. one is for an image slider and the other is a drop-down menu. both jquery driven. one seems to break the other. if i remove the first line of code from one script ( jQuery.noConflict() ), it seems to fix the problem and both scripts work. can someone explain to me what is going on? :/ fyi, i tried renaming variables for one script, hoping their was a naming conflict but that didnt work for me either. <!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 name="viewport" content="initial-scale=1" /> <!-- Apple mobiles --> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="keywords" content = "<?php echo $keywords; ?>" /> <meta name="description" content="<?php echo $description; ?>" /> <title><?php echo $page_title; ?></title> <link rel="icon" href="favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="bmw_styles.css" /> <link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="css/flexdropdown.css" /> <!-- homepage slider --> <link rel="stylesheet" type="text/css" href="slider/css/default.css" /> <link rel="stylesheet" type="text/css" href="slider/css/component.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>--> <script type="text/javascript" src="scripts/global.js"></script> <!-- navigation --> <script type="text/javascript" src="scripts/flexdropdown.js"></script> <!-- homepage slider --> <script src="slider/js/modernizr.custom.js"></script> <script src="slider/js/jquery.cbpFWSlider.js"></script> <!-- initialize jquery when the DOM is ready --> <script type="text/javascript"> $( function() { $( '#cbp-fwslider' ).cbpFWSlider(); $( '#cbp-fwslider' ).cbpFWSlider('interval'); } ); </script> </head> Quote Link to comment https://forums.phpfreaks.com/topic/292330-jquerynoconflict/ Share on other sites More sharing options...
requinix Posted November 7, 2014 Share Posted November 7, 2014 (edited) jQuery.noConflict If you call that then you cannot use the $ shorthand. At least not unless you take explicit measures to use it, like (function($) { // ... })(jQuery); Edited November 7, 2014 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/292330-jquerynoconflict/#findComment-1495976 Share on other sites More sharing options...
BuildMyWeb Posted November 7, 2014 Author Share Posted November 7, 2014 thx requinix Quote Link to comment https://forums.phpfreaks.com/topic/292330-jquerynoconflict/#findComment-1495977 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.