JQuery :: 2 Scripts Mixing Functions - How To Separate Them
Apr 15, 2011
I have two jQuery scripts running on the same page. One of them dynamically assigns height parameters to the wordpress page. The other is a slideshow script which makes images transition from one to the next in a slideshow.When the slideshow is inserted into the wordpress page, it works fine, but in IE7 there is extra page height whenever there is a slideshow on the page. In other browsers it is fine, and on other pages that dont have a slideshow the page height is fine.Looking at the source code, it seems that the dynamically assigned div height paramaters that are injected into the slideshow divs by the jQuery slideshow script are getting involved in other divs on the page, influencing their height.It seems that the slideshow script is interfering with the page height script. how can I make it so they dont entangle? Here is the page height jQuery script that assigned dynamic height to the "art-content-layout-row" div (the div that controls page height)
Code:
/* begin Layout */
jQuery(function () {
if (!jQuery.browser.msie || parseInt(jQuery.browser.version) > 7) return;
[code]...
When looking at the html source in the page, the slideshow script inserts this jQuery unique number beside the dynamically added div parameters in the slideshow divs like this:
It turns out that this same unique number is assigning itself to the art-content-layout-row div which is supposed to be controlled by the other script.I am wondering if the fact that these unique id numbers being the same is causing the issue, as though the system is thinking that these two scripts are somehow the same one?Both scripts are in different directories and called separately in the page footer.
so, I can pass a value from a select list to another function which then decides which function to call, but I want to cut out the middleman, and make the values the function calls, and call them directly on the onchange... I imagine something like this:
Many time i am getting one problem with Jquery when i am using more then one jquery plugin on same page then only one plugin works which will be on top. I guess few variables mixing and disturbing to each other. I just want to know is there any way to control it?
How would I seperate a text string such that it would appear on seperate lines ie. Initial Input: StrMsg = "This is an example of a string that will appear on seperate lines" "Hoping that this fully works, there will be no errors and all will be well" "This is the last line of text."
I have a onClick event in Javascript, What I would like to do is if a PHP variable were to be set, to trigger the Javascript onClick event. Is there a way to simulate an onClick? [URL]I have a form with some non-showing (non hidden) input fields but they show if I click a + and hide if I click -, default is hide, but if a certain PHP var were set I want to somehow simulate that + was clicked. I tried to force 'var lText' but that got the whole thing stuck in one state.
Many modern libraries implement this type of function (I know prototype does), but it's a great one to have in your common.js in case you don't need a full library for projects.
The basic idea is that using .innerHTML to insert new elements is very convenient because you can simply provide a string of the new HTML, but you lose the precision of DOM insertion (for instance, if you want to insert a new element in the middle of a bunch of DOM siblings, you have to replace them all in the parents innerHTML).
Conversely, using DOM methods like insertBefore() are very precise but require you to make the entire structure with createElement calls. This can be a LOT of code when all you want to do is insert a new anchor element.
This elegant little solution combines both methods by riding on the fact than when you replace an element's innerHTML, the browser creates the appropriate DOM hierarchy for the new elements on the fly. So this function takes a string of HTML you want to make into a DOM structure, changes the innerHTML of a dummy element to render this structure, and then returns the first child.
// fromHTML() function fromHTML(html) { var root = document.createElement(‘div’); root.innerHTML = html; return root.firstChild; }
Very simple to use, and very handy:
var node = fromHTML(’<a href=”home.html” title=”Going Home”> <strong>There’s no place like it</strong></a>’);
// Now you can use the precision of DOM methods without having // to create the entire structure by hand: element.insertBefore(thing, node);
Is it possible to have secured (SSL/HTTPS) and non-secured (HTTP) content in the same page without breaking the security? I am developing a secured reservation system in which the user can access Google Maps (not secured). The map is embedded in the page and does not open in a separate window.
What solution do you recommend? Use iframes? If so, how?
I have several forms on the same page that need to use the datepicker plug-in. I have datepicker working PERFECTLY on one form. Now I need to add other forms on the page. I haven't been able to get two datepickers working on the same page nor can I find any documentation on whether it's possible. What do I have to do to get two datepickers working in two separate forms on the same page?
Really struggling trying to get 2 seperate sliders to work on my web page.
take a look at;
[URL]
not a spam its test site so nothing to gain from my end.
the slider at the top works fine, but the 3 boxes with the arrows underneath should scroll/slide back and forward when clicked. If I remove the js links for the top slider the bottom then works;
Calling Jquery function in separate file?I have an html file that includes jquery and javascript functions file (functions.js) that contains a simple jquery function.
I have a page, with two tables, each placed in a div (lets call them div1 and div2), to give the tables a fixed height. I load data into the tables with $('#div1').load() function, but before I load the data, I call $('#div1').block({message: 'wait'}), and in the load callback, I call $('#div1').unblock(). I do the same for div2. The refresh of the two tables sometimes runs in parallel.
The problem is this:
The first two or perhaps three refreshes, I get the expected behaviour, but after that, the overlay is not shown. If I look at the DOM during the opreation (both in Chrome and Firefox DOM inspectors), I can see the blockUI DOM elements being created and removed, but they never show.
I have tried several things, among others this:
1) Call unblock before block, to make sure, that the element is not blocked.
2) Only to have one div blocked - same result
I have not yet made a page with a simplified example, but that would be my next step.
I have a web page with two forms. I would like to click on a button and email both forms, one after the other to two different email addresses. I am new to jquery and I can't figure out the syntax but my attempt is below. I can do this with javascript but it only works in IE and FireFox but not in Chrome.
I'm trying to access a web application that allows single sign-on when it is passed the following HTTP Request headers:
AUTHENTIC: YES AUTHORIZED: YES USER: (user ID from active directory) Here is the code I have so far: $.ajax({
[Code].....
This script is within a blank webpage on my IIS server. Essentially, all the elements of the web app's UI get thrown within a div, but it doesn't seem to be loading the other parts of the page such as the <head>. I read on another thread that it is not a good idea to try and put everything within a div cause of the other html and head tags that already exist. Basically, what I want to do is access the webpage that has the above script and have it re-direct me to the Web Application's URL and adding in the custom HTTP Request headers.
I 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() {
I have an html form and an icon, if i click on the icon, a new pop-up window is open and shows a list of numbers with a structure like this : x.xx.xxx.xxxx.
Now, this numbers are between an <a href> tag and if i clic on one of this, i call a javascript function, the idea is to put each one number separate for the "." in a textbox, so i did it before but putting it in a single input. Now i need to separate each one of this numbers and put it in each one of the textbox. If i have to put it in a single input ill do something like this:
<script language="javascript"> function Funcion(val) { //val value is 1.12.123.1234 window.parent.opener.document.txtCtaNiv.value=val; top.parent.window.close(); } </script>
The code above puts the value (that previosuly i selected in the popup window) in the input field of the main form. That's easy.
Now if the parameter val has the value 1.12.123.1234 and in the main form i have four input fields called txtCtaNiv1, txtCtaNiv2, txtCtaNiv3, txtCtaNiv4, how can i separate the parameter val?, so i can put the 1 in txtCtaNiv1, the 12 in the input field txtCtaNiv2, the 123 in txtCtaNiv3 and so on?
I am using the "lightbox" effect to open my images which uses javascript. I am also using jQuery for the changing banner at the top of the page. Ever since I put the jQuery script in, the "lightbox" script stopped working. When I remove the jQuery script, the "lightbox" script works again. Obviously they are conflicting for some reason. I have included the relevant code below.