JQuery :: Clash Between Functions (Aint Working Togeder)?
May 18, 2011When I write this 2 scripts togeder only one of them works. What do I need to do to make them both work togeder?
[Code]...
When I write this 2 scripts togeder only one of them works. What do I need to do to make them both work togeder?
[Code]...
heres my header:
<script type="text/javascript" src="js/jquery-1.3.2.min.js" ></script>
<script type="text/javascript" src="js/jquery-ui-1.7.3.custom.min.js" ></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
heres my script:
[Code]...
I have created a new theme for Rapidweaver and integrated some neat JQuery animated sliding panels and frankly I was feeling pretty chuffed with my efforts as I am far from a JQuery expert.[URL]..In the side panel on the left, I have embedded a Titter feed widget, lifting the code direct from Twitter. In Safari, Chrome, Opera and even jolly old IE this works fine. But Firefox has a fit and displays a blank page - or just plain won't load. If I remove the Twitter widget the page loads perfectly happily. If I disable Javascript in FF, the page loads (but there is no animation etc) - so there is clearly a JQ/Javascript/Twitter script issue going on here that is causing FF to freak out...
Of course the simple solution is not to add the Twitter feed, but since this is exactly one of the uses I was planning for this sliding panel, that's a fat 'non' option. All the JQuery code I have used for the theme has 'no conflict' calls and I have even added specific calls for specific code - so stuff like:
[Code]...
I find that either of these plugins work in isolation but together they are clashing. The first to be specified in my initialisation code works, the following doesn't. Initialisation code looks like this:
// remap jQuery to $
// jQuery.noConflict();
(function($){
// Infinite Carousel
$('#carousel').infiniteCarousel({
'transitionSpeed' : 2000,
'displayTime' : 10000,
'textholderHeight' : .25,
'displayProgressBar' : 0
});
// Lightbox
$("a.lightbox").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 600,
'speedOut' : 200,
'overlayShow' : true,
'titleShow' : false
});
})(this.jQuery);
Web pages:
Carousel working: [URL]
Fancybox not working: [URL]
I've got 2 questions if that's OK. I have a number of scripts running on a site i'm working on and I think I may be getting a clash with the image preload and another font resizing script. As I am new to javascript I have picked up the code from elsewehere. I am trying to get my head around it reading tutorials etc but am getting stuck when it comes to multiple scripts on the page
There are a number of scripts running: browser detect, png opacity, image preload, layer show/hide and a font resize.
here is the site
Q1 In IE5.5+ on the PC neither the font sizer nor the image preload is working - i think it is a clash of onload events. Can anyone suggest a fix?
Q2 I think there must be a better way to have my images preload. The current code is the dreamweaver version. Is there a better way?
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
onload = function()
{
MM_preloadImages(
'../images/icons/iconO_01.gif',
'../images/icons/iconO_02.gif',
'../images/icons/iconO_03.gif',
'../images/icons/iconO_04.gif',
'../images/menu/menuDown_01.gif',
'../images/menu/menuDown_02.gif',
'../images/menu/menuDown_03.gif',
'../images/menu/menuDown_04.gif',
'../images/menu/menuDown_05.gif',
'../images/menu/menuDown_06.gif',
'../images/menudrop/coD_01.gif',
'../images/menudrop/coD_02.gif',
'../images/menudrop/coD_03.gif',
'../images/menudrop/coD_04.gif',
'../images/menudrop/coD_05.gif',
'../images/menudrop/prD_01.gif',
'../images/menudrop/prD_02.gif',
'../images/menudrop/prD_03.gif',
'../images/menudrop/seD_01.gif',
'../images/menudrop/seD_02.gif',
'../images/menudrop/seD_03.gif',
'../images/menudrop/seD_04.gif',
'../images/menudrop/seD_05.gif',
'../images/menudrop/seD_06.gif',
'../images/menudrop/soD_01.gif',
'../images/menudrop/soD_02.gif',
'../images/menudrop/soD_03.gif',
'../images/menudrop/soD_04.gif',
'../images/menudrop/paD_01.gif',
'../images/menudrop/paD_02.gif',
'../images/menudrop/paD_03.gif',
'../images/menudrop/neD_01.gif',
'../images/menudrop/neD_02.gif',
'../images/menudrop/neD_03.gif',
'../images/disc/discCD_01.gif',
'../images/disc/discCD_02.gif',
'../images/disc/discCD_03.gif'
);
}
How can I get 2 functions working at the same time? Here is what I have at the top:
[Code]...
It seams every time i comment out switch.js the innerfade function works then if I comment out jquery.innerfade.js(image change), switch.js (menu)works. But they do not work at the same time so if the images are changeing I cannot hover over the buttons on the menu they act like a graphic, basically not interactive.
I have a function with the following code:
function saveRecord(){
$("#weekSheet tbody tr").each(function(){
$('td').each(function(i,o){
[code]....
After appending an li by append() function , there is some animations through animate function. But in IE9 , it is not working as expected.
below is my code :
$magicLine.stop().animate({
left: $magicLine.data("origLeft"),
width: $magicLine.data("origWidth")
});
I have a div with a class of .edit
Then once those show up i have
These don't work. however, if i just put them into the div with using the .append they work ?
I was writing some jQuery here code...
but it doesn't seem to be working at all.
When thebody section below iscommented out, I get hello, and when it isn't, I don't !
$("body"
).click(function
(e){
return
[Code]....
Is this a bug, is it an unavoidable aspect of the "live" architecture
I want a function to take another function as a parameter, and execute it as a line of code. I put a simplified example below, just to illustrate the idea. Does anyone know the syntax to do this, or is there perhaps a better approach entirely?
// EXAMPLE
doSomething(5, 10, functionA, functionB);
function doSomething(x, y, myFunctionA, myFunctionB) {
if (x > y) {
myFunctionA();
} else {
myFunctionB();
}
}
function functionA() {
// some code
}
function functionB() {
// some code
}
I've got two functions in one JavaScript file. Only one function ever works at any one time though (whichever one is at the top). One function is for opening links in a new window, the other to get the CSS dropdown menus to work in IE.
I've copied the code in below. I'm sure it's really simple to fix, but try as I might I can't get them both to work at the same time. Code:
This code works fine in in FireFox but not in IE... it's written in Javascript & AJAX but I'm pretty sure the JavaScript is the problem...
Basically what this script is supposed to do is when you select a Product Option, it uses AJAX to fill out the Value drop down box with choices. That works fine.
You then select something from the Value drop down box and it then uses AJAX again to fill out the details into the Weight and Price text boxes... This is where it goes wrong. Code:
I'm trying to create a form that makes use of two Javascript functions.
The form is a table, and when the user begins typing the the 1st row of the table a 2nd row appears. When the user types in the 2nd row a 3rd row appears, and so on. I've created this using appendChild, and it works well.
I also want the fields in the table to make use of autocomplete, so that when the user begins to type, they are shown a list of predictions for what they are typing. I do this by setting the id of an input on the form to be id="autocomplete".
Individually both these functions work. However, when I combine them, the rows that are added to the table do not work with autocomplete - only the rows which appear when the page first loads give predicted options when the user begins to type.
I would be very grateul if someone could explain why the newly added fields don't work with autocomplete, and suggest a solution. The relevant code is below.
PHP Code:
$(document).ready(function() {
$("input#autocomplete").autocomplete(
{ source: "/autocomplete_queries/admin_base_disciplines.php",
delay: 10,
[Code].....
I'm trying to trap a user entry that cannot be found in the database. When a code is entered, the page should give a "Code Not Found" message if it is an undefined value.
However, it didn't; and it always shows the "undefined" value to the page instead.
Here's what I actually did:
getting user input:
Finding the code:
I download the jquery library, when i include it as such:
It loads but i always get some sort of error in the functions in the page or something...as if the js is loaded but not correctly or as if it's missing, even though the download itself is correct
If i change the include path to (which is the exact same file i downloaded):
Everything works fine i am thinking maybe it could be something that has to do with encoding maybe? am not sure...any clue? it's only happening with the jquery JS files, the rest are working fine.
I added the Javascript code that denies viewers of the website access to the right click functions. It works perfectly in Internet Explorer but when you view the website in Google Chrome you are able to right click and copy, etc. Why is that? Am I missing something in the coding or is it something else?
View 8 Replies View RelatedI have written a number of functions designed to return frequency data on 1000 randomly chosen numbers using different math functions for the rounding. I would like to include all of these functions within the wrapper of another function so that only one call is needed to get returns from all of the 'inner' functions. However, while each of the functions works in isolation, the moment I wrap them in another function they stop working. :confused:
The following code is one of the functions 'frequencyWrapperOne' that has been wrapped in the function 'testWrapper'. A call to testWrapper does nothing.
function testWrapper()
{
function frequencyWrapperOne()
{
[Code]....
$(something).split(something),this is a function with a function as a property for that function.
View 8 Replies View RelatedI have several form in my site, that validate on onsubmit.I call all the validation functions from a file call functions.js.Here is a sample of the code that is working:
<form name="contact" action="contact-insert.php method="post" onSubmit="return checkform()">
<label class='SubHeadlbl' for='TextField1'><?php echo IDS_EFORMNAME?><br></label>
<input type='text' name='dfname' class='text_field' id='dfname1' size='70' maxlength='40'/>
</form>
all the other forms are not working. all have the same structure:
<form name="frm1000" action="frm1000-insert.php method="post" onSubmit="return checkform1000()">
<label class='SubHeadlbl' for='TextField1'><?php echo IDS_EFORMNAME?><br></label>
<input type='text' name='dfname' class='text_field' id='dfname1000' size='46' maxlength='40'/>
</form>
I don't know what is happening only one for work all the others don't.
I am using this: [URL]... plugin to jquery ui. The problem is that it's not working at all. I downloaded the firefox debugger and it's spitting out a error saying that it can't find the function of carousel. I am not sure what the function is called. Their is no documentation but their are demos that I can look at the source code. I see them using .carousel as a function so I used that same function call. Yet I can't get my carousel to work.
View 1 Replies View RelatedI've got code.
<script type='text/javascript'>function _get<% $type[$k].id %>(id,action){$('#load_list<% $type[$k].id %>').load('<% $URL %><% $md %>/load_list/'+id+'/'+action+'');}</script>
<!--<script type='text/javascript'>function scrollWin<% $type[$k].id %>(){$('html,body').animate({scrollTop:$("#scrollToHere<% $type[$k].id %>").offset().top},2000);}</script> -->
I need to combine these 2 functions in order to get use them withonclick ='javascript:_get1("2","x"); ' + how to do "preloader" to the function _get() (that loads image file from, [URL]
I'm building an intranet site for work with an autocomplete feature. I have it working to where when the user clicks on the name in the autocomplete list, it will fill that value to the text input box. What I need it to do is after it fills in the value, also submit the form, à la Google. I would usually research how to do this, Here's what I have for the code so far.
[Code]...
I have the following pieces of jquery code.
$(function () {
$('select[id$=lstOwnership]').bind("change keyup", function () {
if ($(this).val() == 2) {
[code]....
Based on this logic, I'd like to show/hide the ID tag based on the values of a drop down list and another textbox. They both work fine but the problem I'm having is that each can cancel out the other. For example, if the 'txtPercentOther' textbox value is 3 and the drop down item has a value of 2, the ID tag is shown which is fine. But if I were to change the drop down list value to something else, it'll hide the ID tag, even though the other text box still has a value of 3 which means the ID tag should remain shown. I'm wondering if I maybe need to name my function so I can call the other in each.
with 1 click i would like to trigger 2 different funcions that affect different divs/images .. first it's lsupposed to oad some images into a div, and then resizing them ...I can only get the first function to work, the height resizing does not work.
$(document).ready(function() {
var height = $(window).height();
$("#c
[code]....