Is there more efficeint way of writing multiple functions?
Hi , I am very exciting about jQuery but a am not programmer and the way I write functions is probably not most efficient. For example I have 12 collapsible panel that I need to control. Is there better way of writing this? <script> $(document).ready(function() { $('.open-close').text('Read More...') $('.faq-1oc').toggle(function() { $(".faq-1").fadeIn(); $(this).text('Close'); }, function() { $(".faq-1").fadeOut(); $(this).text('Read More...');
cant change Class after setTimeout???
I'm trying to set a class after a brief delay using the setTimeout function, but when it enters the code it does nothing. I can change the class before this, just not after it????? This a bug or something that's just not possible?? Below is my code: $(document).ready(function() { $('[id$=fcrTopInfoDiv]').hover(function(){ $(this).removeClass('fcrInfoDiv').addClass('fcrInfoDivNew'); $(this).animate({top:'154px'},{queue:false,duration:400}); $('div.innerFcrDiv').animate({top:'151px'},{queue:false,duration:400});
Function runs succesfully once and then is stuck in its initial values. Is there a way to clear the values?
Hello The following code scrolls the page for me just fine once any one of three links calling on the function are clicked function crw_travel(rw_X, rw_Y){ var caller = this $(caller).click(function (event) { event.preventDefault() $("html:not(:animated),body:not(:animated)").animate({ scrollTop: rw_X, scrollLeft: rw_Y},2000); }) }//END FUNCTION RW_TRAVEL Here is the code calling on this function <a href="#" onclick="crw_travel(1132,1088)"
ajax, jquery and 1 file function php
I've seen a few tutorials explanning how to do ajax things with jQuery and all of them from what I've seen was use a ajax jquery command to go see a .php file which is only the function you want. But I have a function.php while and I rather call my functions in the file I am working on or direct my ajax to a particular function in that file. Is any of that possible? Or do I really need a file per function like jQuery.post(login.php ... Thanks
JQuery & SVG document - errors?
My website is all generated SVG. The JQuery jscript is accessible by the website: I can view its contents at http://localhost:8000/static/js/jquery-1.4.2/js. The initial SVG: <svg id="root" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" onload="myinit(evt)" width="100%" height="100%"> One of my js files contains this: $(document).ready(function(){ $("#stats").draggable(); }); I'm seeing errors in Chrome's console: Uncaught TypeError: cannot set property
DOM & jQuery
Hi, All. There is a JS-code: $(".slider").click(function() {alert( $(this).parent("table.question > tr > td > input").attr("name"); }); and HTML (DOM): <table border="1" width=50% > <tr> <td> <table border="0" width=100%> <tr> <td colspan=21 align=center><input name="001001" type="hidden" value="1001" />1. Не везет, так не везет...</td> </td> <tr> <td> <div class="slider-container" style="width:500px; margin:auto; vertical-align:top;"> <div id="slider_1" class="slider"></div> <div class="scale"></div>
ajax response truncated
I have an ajax post which returns a large html response. It is getting truncated at 98784 characters everytime. Is there a limit to a response size or a way around this? Using: IE7 jQuery 1.4.2 jQuery UI 1.8.1 Here is my ajax call: $.ajax({ url: params, error: function(XMLHttpRequest, textStatus, errorThrown){alert(textStatus)}, success: function(html){ endDiv = html.indexOf('/div>')+5; html = html.substring(endDiv, 100000); html = $.trim(html); // alert(html.length); id = 'Edit Mapping';
Form Submit problem
I've tried to make a form getting send by a standard button, but it didn't went well. In the following code, the alert was executed but the form wasn't send. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-8-i" /> <title>Untitled</title> <script type="text/javascript" src="jquery.js"></script>
How to focus in a page with JQuery
Hello, I'd like to know how do this with jQuery: <a id="id_a" href="#table">Go to the middle of the page"</a>When I click at this link I go to that table. I'd like to "go" to this table with jQuery. Can you help me? Thank you so much!
display to none on mouseover
Hye there, I'm currently working an a script that covers a large div with smaller divs. When a user goes over a smaller div it has to disappear so a small piece of the large div underneath becomes visible. That was quit easy, but now comes the tricky part. I want that only the div which is underneath the cursor of the user to disappear. In my current script all the small divs disappear until it reaches the div that underneath the cursor. Some one a solution? here's my script $(document).ready(function(){
Skip links don't work because of jQuery code
Hello everybody, I have a question referring to the coda slider presented by Remy Sharp on jqueryfordesigners.com. The description says: This technique demonstrates an accessible 'Coda'-like slider interface, but in addition, allows you to place links to the sliding content anywhere on the page and have the effect (and navigation) still work. The problem: Since the links from anywhere on the page to the sliding content take the ID of the respective slider panel, e.g. like this: <a href="#books">
Resizing width depending on $(window).width
Hi there, once again I need help ^^' I've recently start using Flexigrid (old JQuery grid plugin), and, as you may know, one of the few issue this really good grid plugin got is the lack of liquid layout option. My personal idea to solve the problem is to set the "width" parameter depending on $(window).width. Here is the problem (and here's why i post this question in "General use" and not in "Plugin"). The starting, and working, code is: $(document).ready(function(){ $("#flex1").flexigrid
is there any way to _reliably_ load jquery through an XmlHttpRequest?
Dear all I am trying to load jquery through an xmlhttp request and then inject it into the page. If this is possible, it would speed up parallel page loading and improve the rendering behavior for most browsers. However, it seems that jQuery cannot reliably initialize itself when it is only later injected into the document. Does anybody have a viable solution/workaround for loading jquery asynchronously and actually uses that technique productively? It seems that jQuery gets into trouble if it doesn't
Ajax call not working within click handler function?
I have the following code: $(document).ready(function(){ $('#link').click(function() { alert('Clicked!'); $('#content').load('dialogs/load/content', function() {}); }); });The link is a normal link that is not dynamically created. The alert works. I know the problem is not the Ajax call because this works just fine: $(document).ready(function(){ $('#content').load('dialogs/load/content', function() {}); $('#link').click(function() { alert('Clicked!'); });
use click event on the response message sent using jquery/ajax
I get a response message from the php file when i ajax to communicate to the db using $.get i have an id assigned to my return message and would like to trigger events to that as well but it does not work. below is the code that calls my php file and passes the callback function (show_data) [code] function start(){ $("#tt").click(send_data); } $("#rr").click(send_data); function send_data(){ $.get('ret.php?',show_data) } function show_data(res){ $('#result').html(res); } $(document).ready(start);
I have a problem with floating div
I have a list of div as shown in attachments this posts "inizio.gif" but the problem is that div are of different heights see attachments: "problema.gif" can be solved with jquery like in attachements: "risultato.gif"??? Help me!
JQuery and IE just can't seem to get along !!!!
So this is weird, anyone have any ideas on this? : Debugging my project, so I started putting in Alerts to see where and when certain functions were called. In IE, the alert message pops up everytime a new page is loaded, so either cuz the page loading, or the menu building, not sure. But in all other browsers, that alert message never comes up, so I am assuming this function only gets called in IE??? And another thing that is weird is, my alert is "Hi Dave" so when IE calls that function, it says
Strange Jquery Ajax toggle issue...
I am having a strange issue and I wanted to know if anybody has experienced this... I have a simple ajax feature like I listed below... And I have a set of buttons... When you click a button, it calls this ajax and populates a div container... Pretty simple stuff... Problem is... That if I click from button to button a few times, the div container seems to flicker really bad, it seems like it flips back and forth between the previous content and the new content... It is not a delay thing, but moreso
Jquery submenu problem in IE
Not sure which forum to post this in, so I will try and post it in 2 forums. Could someone please explain to me why my jquery flyout menu works perfectly fine in google chrome, but in IE8, it throws errors? I abandoned my javascript flyout menu for the whole purpose of getting jquery because of the cross browser compatibility. Anyways, I will tell you what is going on here and if someone with some knowledge could explain to me why I am getting errors, I would greatly appreciate it. When I click on
Memory retention using jQuery ajax
Hi there, I have some code that appears to cause memory to be retained by the browser. I have observed this memory retention in Safari, the nightly WebKit build and also Firefox; all using the latest versions of jQuery and the browsers themselves. The code performs a query and then queues up another query to be performed (I'm using a polling-consumer pattern on my backend-resource). // Perform the Ajax request and handle failures. FidsDataController.getFids = function(dataController) { dataController.getFids();
No submenu
Hello, I was wondering if someone could help me with this. I have a master page with a vertical flyout menu written in jQuery. So this is what happens : I can hover over the main menu tabs, and the submenu appears when hovered over. But then I will click one of the links (either main menu tab, or submenu tab ) and I will get redirected to the correct page, but then the menu will not show the submenu when hovered over. Until I click a link again, and then get redirected again, and then the submenu
json returning data
hey guys im having a problem returning the data in the json array...when alerting data.value it comes back at 1000+ which is truely incorrect....can anyone explain where i am going wrong please?...thank you <!DOCTYPE html> <html> <head> <script type="text/javascript" src="/ajax/jquery/libary/jquery.js"></script> </head> <body> <?php $game_type = array(); $division = array(); if ($_POST['game'] == 1) { $game_type[] = array('value' => '1', 'text' => 'TDM' ); $game_type[] = array('value' => '1', 'text'
Getting id of clicked div and using it.
Hi, I'm using the top z-index plugin which works fine using this: *$("#name").click(function(){ $("#name2").topZIndex(); }); However, I have many divs on the page that act as triggers for the divs that have their z-index changed and I'm trying to write a function that will work for for them all. All of the triggers have the same class "trigger", they all each have their own id. Each of these triggers has a corresponding div which is targeted using the plugin, these have the same id as
Problem with queued events (Ajax load) in my plugin
Here is the code (my questions at the bottom): ;(function($) { $.fn.tq_contentslider = function(o) { var options = $.extend({}, $.fn.tq_contentslider.defaults, o); return this.each(function() { //get metadata if plugin available var opts = $.metadata ? $.extend(options, $.metadata.get(this)): options; //set initial menu and content display on page load var $menubar = $(this); var $container = $('#'+opts.container_id);
click event on result from ajax call
how can i fire a function on click event for an element dynamically returned from an ajax call
Problem with .delay() possible conflict.
I am trying to accomplish 4 actions: 1. Load random background image. 2. Background image dynamically resizes to page maintaining aspect ratio. 3. Fade in the background image and content. 4. Delay the fade-in of the webpage. I am able to accomplish 1-3, however when I add the .delay() to the code, #2 is affected: the page doesn't load with the image sized to the window (depends on your window size). The minute you attempt to resize the window, it kicks in and sizes it. See example here: www.fixxed.net/tn/index.html
Re-establish hover upon delay
I'm trying to wrap my head around this concept of having a div tag be clickable and hoverable, but upon clicking on it the "hover" functionality be removed and upon clicking it again the "hover" functionality be ADDED again, but with a slight delay. The following is my code, but I cant figure out how to add in the delay for this? Any ideas or suggestions with what I have? Thanks in advance $(document).ready(function() { $(function() { $('div.fcrInfoDiv').hover(function(){ $(this).animate({top:'170px'},{queue:false,duration:400});
Accordion styling
Hi Please be gentle, first time posting. I am using wordpress, finding jQuery sooooo cool I have decided to learn from the ground up. I have decided to add an jQuery accordion for content in one of my pages. Firstly, there are manay, many different demos etc online which I am still browsing through. Could anyone recommend a site/demo/tuturial for an accordion that is all closed on start and opens on hover? Secondly, the ones I have come across so far have all the same header (main links
form submitting with jquery
Hello, I have a problem with a file upload form , i dont know why, but the form dont want to be submitted <script> $('#submitFormUpload').click(function() { alert("click form2"); $('#FormUpload').submit(); $('#upload_wait').html ( '<img src="images/ajax-loader2.gif" alt="" />' ); } </script> <form action="ajax/upload-media.php" target="frame_upload_target" name="FormUpload" id="FormUpload" enctype="multipart/form-data" method="post" style="display:inline;">
Easy Jquery slider pls help im a virgin :) at jq
Hi im just starting a redesign of my old website and trying to put a easy jquery slider on but its my first time any help please most of the site is still images i wont to get the slider working forst as im a virgin at it lol http://www.dyslexiawebs.co.uk/new/ Thanks Daniel
ajax call to a web service and cross-domain issues..
Is it possible to use $.ajax to call an external web service directly, or do I need to write a dot net server-side wrapper to consume the web service, then call the wrapper from jQuery ? I have attempted a direct call as shown below, which works fine in IE but generates an error in Firefox, which I presume relates to the cross-domain scripting issue. $.ajaxSetup({ cache: false }); $.ajax({ type: "GET", url: "http://services.aonaware.com/DictService/DictService.asmx/Define",
Zoom a full page using jquery?
Hi All I am wanting to zoom the whole pagelike you can do by pressing ctrl + with the use of buttons on the actual website. Is this possible with jquery or javascript please? Thanks in advance
issues with ajaxStart function used together with $.getJSON
I have a problem in displaying the "Loading..." text in a Div using ajaxStart function, while a $.getJSON call is in progress. Could you please suggest , what am i doing wrong here ? <div id='loading' style='display:none' /> $(document).ready(function() { $("#loading").ajaxStart(function() { $(this).show(); }); $.getJSON('xxx.ashx?tabID=' + 0, function(statuses) { $.each(statuses, function() {
Why the line breaks in 1.4.2?
I notice the minified version of 1.4.2 uses line breaks around column 500-510, where 1.3.2 did not; any reason? http://code.jquery.com/jquery-1.4.2.min.js vs. http://code.jquery.com/jquery-1.3.2.min.js Only means .1kb in file size, but sure makes scrolling through my global JS easier when jQuery is only one line... I thought I had read something some time back about "ideal line lengths" or something, but can't seem to find any such references on Google now... Thanks, Atg
jQuery Coda Slider: A Problem
Hello everybody, I am a JS beginner and I have a question referring to the coda slider presented by jqueryfordesigners. The description says: This technique demonstrates an accessible 'Coda'-like slider interface, but in addition, allows you to place links to the sliding content anywhere on the page and have the effect (and navigation) still work. My problem: Since the links to the sliding content look e.g. like this http://jqueryfordesigners.com/demo/coda-slider.html#books now my link to the top
Multiple live change
Good afternoon.. I have multiple inputs with names like "price1","price2" etc. and they added in the document dynamically after a user event. I want to bind a function to them so everytime a change event occur to each one, i can calculate the new price. I try to use $("input[name*='price']").each(function(index){}); but I can't to this with live method and combine the change event too. I'm a bit confused and a nice advice would be really appreciated. Thanks in advance..
Race condition with jQuery.ajax({async:false})
I have just tested this code (abstraction): $.ajax({ ... async: false, success: function(data) { // do some sluggish post-processing alert(2); } }); alert(1); And on my multi-processor, multi-threaded box I get the alerts in order 1, 2. I frankly expected 2, 1. It therefore seems to me that a synchronous $.ajax call returns as soon as the data has been received, and not (as I think is very reasonable to expect) when the
Best way to use a textarea for keeping a log
Hi all, I need to keep a log in a test application, so I'm using a textarea for that, and I'm appending text using the += operator. Follows the trace function which fills the textarea: window.trace = function(s) { if ($('#enableLogCheckBox').attr("checked")) { var logArea = $('#logArea')[0]; logArea.value += s + "\n"; logArea.scrollTop = logArea.scrollHeight; } } This technique has a serious problem, the application severly slows down as the number of lines in the
Passing focus to sibling element
Hi there. I have an issue that I can't seem to solve. I have a html structure like so: <div id="linksDiv"> <a id="myLink">This is a link</a> </div> <div id="hoverDiv" style="display:none;"> <p>This is some content</p> </div>I have some jquery code that will show "hoverDiv" when you hover over the anchor "myLink". This issue is that I then want to be able to hover over the sibling div "hoverDiv" which is positioned absolutely just below "linksDiv" (they are both touching). But what happens
WYSIWYG editor in jQuery
Hi there, I'm building a WYSIWYG editor in jQuery, and right now I'm working on inserting links. I am using HTML5's contenteditable feature, that allows e.g. a div to be edited: <div contenteditable="true"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
Next Page