Jump to content

Conflito de javascript


pluis3103
 Share

Recommended Posts

Boa tarde,

Tenho um problema. Estou a utilizar dois scripts que isolados funcionam mas que juntos me dão erro. O primeiro é o fancybox, o segundo é para igualar a altura de 3 divs. O que posso alterar para eles não entrarem em conflito?

Script 1-

       <script type="text/javascript" 

src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>   
        <script type="text/javascript" src="/lib/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
    <script type="text/javascript" src="/lib/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" type="text/css" href="/lib/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
    <script type="text/javascript">
        $(document).ready(function() {

  

            $("a[rel=example_group]").fancybox({
                'transitionIn'        : 'none',
                'transitionOut'        : 'none',
                'titlePosition'     : 'over',
                'titleFormat'        : function(title, currentArray, currentIndex, currentOpts) {
                    return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + 

currentArray.length + (title.length ? '   ' + title : '') + '</span>';
                }
            });



            $("#various3").fancybox({
                'width'                : '75%',
                'height'            : '75%',
                'autoScale'            : false,
                'transitionIn'        : 'none',
                'transitionOut'        : 'none',
                'type'                : 'iframe'
            });

            
        });
    </script>

Script 2-

<script type="text/javascript">  
function $() { 
var elements = new Array(); 
for (var i=0;i<arguments.length;i++) { 
var element = arguments[i]; 
if (typeof element == 'string') element = document.getElementById(element); 
if (arguments.length == 1) return element; 
elements.push(element); 
} 
return elements; 
} 

var BoxHeights = { 
maxh: 0, 
boxes: Array(), 
num: 0, 
equalise: function() { 
this.num = arguments.length; 
for (var i=0;i<this.num;i++) if (!$(arguments[i])) return; 
this.boxes = arguments; 
this.maxheight(); 
for (var i=0;i<this.num;i++) $(arguments[i]).style.height = this.maxh+"px"; 
}, 
maxheight: function() { 
var heights = new Array(); 
for (var i=0;i<this.num;i++) { 
  if (navigator.userAgent.toLowerCase().indexOf('opera') == -1) { 
  heights.push($(this.boxes[i]).scrollHeight); 
  } else { 
  heights.push($(this.boxes[i]).offsetHeight); 
  } 
   } 
  heights.sort(this.sortNumeric); 
  this.maxh = heights[this.num-1]; 
}, 
sortNumeric: function(f,s) { 
  return f-s; 
  } 
  } 
  window.onload = function() { 
  BoxHeights.equalise('coldir','colesq','corpo'); 
  } 
</script>

Obrigado

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.