Jump to content

jQuery.noConflict()


BuildMyWeb

Recommended Posts

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>
Link to comment
https://forums.phpfreaks.com/topic/292330-jquerynoconflict/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.