Magento Forum

IGLightbox / Fancybox / jQuery issues
 
JamesTaylor
Jr. Member
 
Total Posts:  2
Joined:  2011-03-30
 

Hi everyone, this is my first post on here so please excuse any bad etiquette as it\’s entirely un-intentional!

I\’ve been building my first Magento site over the last few weeks / months and it\’s been quite a learning curve and very time consuming at times but so far I\’ve been able to get to the bottom of any issues I\’ve encountered by \’googling\’ and following my nose so to speak!

However… I\’m now getting close to completion and have come across a problem for which I previously had the functionality working. My problem is with a Lighbox plugin - igLightbox - which is using FancyBox, the problem is that when clicking on the images on product pages the lightbox is not being loaded and the images are being displayed individually on a \’blank\’ page.

I think the problem lies with either a jQuery conflict or similar having googled the issue but i\’m not getting anywhere… my jQuery / javascript knowledge is very poor and ultimately i\’m not sure how efficient the use of the jQuery is in my Magento site now as obviously different plugins all want to load jQuery files etc.!

From the console in chrome I am being shown the following error which ultimately ii think is the root of my problem:

Uncaught TypeErrorObject function $(element{
  
if (arguments.length 1{
    
for (var 0elements []length arguments.lengthlengthi++)
      
elements.push($(arguments[i]));
    return 
elements;
  
}
  
if (Object.isString(element))
    
element document.getElementById(element);
  return 
Element.extend(element);
} has no method \'noConflict\'

Uncaught TypeErrorObject [object Object] has no method \'fancybox\' 
(anonymous function)

So, i\’m looking for a bit of help and point in the right direction if possible! An example page of the site illustrating the problem can be seen An example page of the site illustrating the problem can be seen here and any help would be much appreciated.

Thanks in anticipation!

James

 
Magento Community Magento Community
Magento Community
Magento Community
 
PawanKumarNambi
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2013-12-05
 

I am trying to add youtube video but its not working properly how to i can resolve this issue if any one knows help me please

File Attachments
view.phtml  (File Size: 13KB - Downloads: 2)
 
Magento Community Magento Community
Magento Community
Magento Community
 
PawanKumarNambi
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2013-12-05
 

this is my code i think it is correct it’s not working properly if any one knows help me how to resolve


<script language="javascript">
jQuery.noConflict();
function openYouTube(id){

//YouTube Player Parameters
var width = 500;
var height = 400;
var FullScreen = “yes”;
var AutoPlay = “yes”;
var HighDef = “yes”;

//Calculate Page width and height
var pageWidth = window.innerWidth;
var pageHeight = window.innerHeight;
if (typeof pageWidth != “number"){
if (document.compatMode == “CSS1Compat"){
pageWidth = document.documentElement.clientWidth;
pageHeight = document.documentElement.clientHeight;
} else {
pageWidth = document.body.clientWidth;
pageHeight = document.body.clientHeight;
}
}
// Make Background visible…
var divbg = document.getElementById(’bg’);
divbg.style.visibility = “visible”;

//Create dynamic Div container for YouTube Popup Div
var divobj = document.createElement(’div’);
divobj.setAttribute(’id’,id); // Set id to YouTube id
divobj.className = “popup”;
divobj.style.visibility = “visible”;
var divWidth = width + 4;
var divHeight = height + 20;
divobj.style.width = divWidth + “px”;
divobj.style.height = divHeight + “px”;
var divLeft = (pageWidth - divWidth) / 2;
var divTop = (pageHeight - divHeight) / 2 - 10;
//Set Left and top coordinates for the div tag
divobj.style.left = divLeft + “px”;
divobj.style.top = divTop + “px”;

//Create dynamic Close Button Div
var closebutton = document.createElement(’div’);
closebutton.style.visibility = “visible”;
closebutton.innerHTML = “<span onclick=\"closeYouTube(‘“ + id +"’)\" class=\"close_button\">X</span>";
//Add Close Button Div to YouTube Popup Div container
divobj.appendChild(closebutton);

//Create dynamic YouTube Div
var ytobj = document.createElement(’div’);
ytobj.setAttribute(’id’, “yt” + id);
ytobj.className = “ytcontainer”;
ytobj.style.width = width + “px”;
ytobj.style.height = height + “px”;
if (FullScreen == “yes") FullScreen="&fs;=1"; else FullScreen="&fs;=0";
if (AutoPlay == “yes") AutoPlay="&autoplay;=1"; else AutoPlay="&autoplay;=0";
if (HighDef == “yes") HighDef="&hd;=1"; else HighDef="&hd;=0";
var URL = “http://www.youtube.com/v/” + id + “&hl;=en&rel;=0&showsearch;=0” + FullScreen + AutoPlay + HighDef;
var YouTube = “<object width=\"” + width + “\” height=\"” + height + “\">";
YouTube += “<param name=\"movie\" value=\"” + URL + “\"></param>";
YouTube += “<param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param>";
YouTube += “<embed src=\"” + URL + “\” type=\"application/x-shockwave-flash\" “;
YouTube += “allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"” + width + “\” height=\"” + height + “\"></embed></object>";
ytobj.innerHTML = YouTube;
//Add YouTube Div to YouTube Popup Div container
divobj.appendChild(ytobj);

//Add YouTube Popup Div container to HTML BODY
document.body.appendChild(divobj);
}
function closeYouTube(id){
var divbg = document.getElementById(’bg’);
divbg.style.visibility = “hidden”;
var divobj = document.getElementById(id);
var ytobj = document.getElementById("yt" + id);
divobj.removeChild(ytobj); //remove YouTube Div
document.body.removeChild(divobj); // remove Popup Div
}
</script>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top