[jQuery] Help with horizontal sliders (accordion)
I'm trying to create some horizontal jquery tab sliders, and being somewhat new to jquery, I'm having a little trouble finishing off the logic. My current code snippet is here: $(document).ready(function(){ $(".trigger").click(function(){ $(this).toggleClass("active"); $(this).parent().siblings().width(46).end().width(453).end(); $(this).next("div").show(); $(this).parent().siblings().find(".slidecontent").hide(); }); and the full code can be found at http://developer.erg.com/~bzaks/erg/test.html What I'm going for is: - Click on a bar link and it slides left exposing the content for that panel, and meanwhile switching that bar to it's ON state (which is just an image swap). Click on another bar, and the next piece is exposed while the first is hidden. Now this part works more or less ok.. the issues that I'm currently having are: 1. Once a bar is clicked, if you click the same bar again, it's on/off state should NOT change (which is currently is). In other words, the little arrow on the bar selected should only be pointing right when that panel is open, and pointing left (the OFF state) all other times. 2. I can't seem to get the widths of the panel content to fit correctly, even though when I create the pages in static, they look fine. (http://developer.erg.com/~bzaks/erg/u5.html, http://developer.erg.com/~bzaks/erg/u6.html, http://developer.erg.com/~bzaks/erg/u7.html) Also, if there is any way to get an actual slide effect, rather just the instantaneous width change (say with using .animate() maybe?), that would be a bonus. But for now, I'd at least like to try to get this part working properly. Any help would be greatly appreciated. Thank you:) -TurboRogue
[jQuery] Re: Tablesorter plugin: adding alternating colors
The row coloring is done on client-side (with tablesorter itself). It works on document load. However, after sorting, all rows become the same color. Why is row coloring not preserved after sorting? What can be the reason? Here is a snippet: - Text Text Text Number Time . - $(document).ready(function() { $("#tableID").tablesorter({ headers: { 4: { sorter: 'time' } }, widgets:['zebra'], widgetZebra: {css: ["even","odd"]} }); }); - .odd { background-color: ... } .even { background-color: ... } - On Dec 18, 7:08 am, MorningZ wrote: > "I was trying to fix that with Zebra > widget but gave up." > > Well, thistablesorterplugin most definitely does work, both on load > and client sorting > > i'd suggest being more descriptive on why you gave up (explanation? > example code? question to clarify what it does?), instead of trying > to recreate code that already works > > On Dec 17, 10:41 pm, adeveloper wrote: > > > My table has alternating row coloring. It get's messed up after > > sorting (eg, instead of odd, even, odd I get something like even, > > even, odd, even, even...etc) I was trying to fix that with Zebra > > widget but gave up. > > > All I need to do is to call this simple function > > tohttp://www.sitepoint.com/article/background-colors-javascript/, but I > > am not sure where. I tried putting into: > >
[jQuery] Split button plugins (?)
I'm just checking if there is any split button plugins/work already done in jQuery community? Google returns none. What is split button: http://vincenthomedev.files.wordpress.com/2008/04/image1.png Other implementation: Yahoo! email reply button TIA -- Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/
[jQuery] How can executable jquery/jscript be returned in an Ajax response
Let's say filling a form should add a row to a table. Responding with the html row is not a problem, but how do you include the event to add the row and any listeners which might follow after it? Thanks
[jQuery] Re: Superfish, Submenu not appearing on page load
Thanks a lot, that observation did indeed correct the problem... Much appreciated :) On Dec 18, 10:08 pm, Joel Birch wrote: > Hello, > > Looking at the source of that page I notice you are initialising > Superfish twice. If you delete the first block (the one without the > pathClass option) I think that should fix your problem. > > Joel Birch.
[jQuery] validating form with server-side code via ajax (progressive enhancement)
Just bumping in hopes of any fresh ideas on this.
[jQuery] Re: problem checking input
It's always true, because it's always returning an object, albeit an empty one. You need to use the length property. Please take a look at the solution I offered to your other post. Also, I know that sometimes posts can take a while before they appear, but please be patient and try not to ask the same question repeatedly. It is very difficult to to keep up with all of the emails coming through, even without the redundancy. Thanks! --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 18, 2008, at 9:30 PM, sneaks wrote: http://paste.pocoo.org/show/95986/ simple quiz function if the radio in li.correct is checked, then the user has selected the correct answer from a multiple choice set. right now i am getting a true no matter which radio is selected in the group thanks for any help in advance thhis one has been bugging me for a while now! j
[jQuery] Re: problem traversing
Hi, The selector is choking on the prev() filter. You can't start traversing down within the method that is only looking for a previous sibling. Also, you can simplify things quite a bit by using the ":checked" selector and the .length property. Try this: $('a.quiz-next').bind('click', function() { if ($(this).prev("ol").find("li.correct :checked").length) { alert(1); } }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 18, 2008, at 8:05 PM, sneaks wrote: hi i am attempting to make a small quiz and am having a setback... i was hoping someone could provide a hint or solution. heres the html: What is apple in french? Pomme de terre Poire Appeaux Pomme Next and the jquery: $('a.quiz-next').bind('click', function() { if ($(this).prev("ol li.correct input[type='radio']").attr('checked') =='checked') { alert(1); } });
[jQuery] problem checking input
http://paste.pocoo.org/show/95986/ simple quiz function if the radio in li.correct is checked, then the user has selected the correct answer from a multiple choice set. right now i am getting a true no matter which radio is selected in the group thanks for any help in advance thhis one has been bugging me for a while now! j
[jQuery] Convert form data to xml
Folks, Looking for pointers to convert form data into xml. please help. Thanks all
[jQuery] problem traversing
hi i am attempting to make a small quiz and am having a setback... i was hoping someone could provide a hint or solution. heres the html: What is apple in french? Pomme de terre Poire Appeaux Pomme Next and the jquery: $('a.quiz-next').bind('click', function() { if ($(this).prev("ol li.correct input[type='radio']").attr('checked') =='checked') { alert(1); } });
[jQuery] Simplemodal plugin position problem subsequent loads
I am using simplemodal perfectly fine everywhere but on one page it loads the content off to the right side of the screen on subsequent clicks. The first time the modal loads perfectly centered as it should but the second time it is on the right side of the screen and further towards the bottom and stays there for all subsequent loads. Any ideas?
[jQuery] Re: Superfish: IE6 Links in drop down fail to work
ptoly... try making the 's position:relative; this helps me out of a few of ie6 link bugs j On Dec 18, 8:48 pm, ptoly wrote: > Hello All, > Very odd behavior in IE6 that is driving me crazy. > > http://ymf.org > > Take a look at the drop down menus in IE6 (work fine in FF, Safari, > IE7). Can't get the links to work at all in the drop down, except for > the last link in the Programs section - Wells Fargo. I've tried > removing the various divs below the navigation bar but the menu > continues to fail. > > I've play with various z-index settings but, others than managing to > stop IE6 from settling the menu's behind the lower portion of the > page, the links don't come to life. > > What is really, really odd is how that single last link works. Should > be a clue to the problem. But I'm flummoxed. > > Any ideas anyone? > > Thanks in advance!
[jQuery] Re: jQuery reloads all JS files on show()
If you are still seeing this problem, please reply with a test case: http://dev.jquery.com/ticket/3707
[jQuery] Re: Superfish, Submenu not appearing on page load
Hello, Looking at the source of that page I notice you are initialising Superfish twice. If you delete the first block (the one without the pathClass option) I think that should fix your problem. Joel Birch.
[jQuery] Re: Advice about Jquery selectors and updating content in DIV
Thanks a lot ! I missed you answer ! Ced On 21 oct, 16:27, ricardobeat wrote: > You should wrap all your HTML for a single 'hit' inside a tag so you > can refer to it easily, like: > > Hit > 484 > > > Then your script could look like this (you can assign click handlers > to multiple elements at the same time): > > $('.hit').click(function(){ > var id=this.id > var hit = this; > $.post('../../posts/hit.php', {id:id}, function (data){ > if (data == 1){ > > $(hit).children('hit_output').text(newvalue); > $('#responseSuccess').slideDown(1000).fadeOut(4000); > > }; > }); > return false; > > }); > > For the response message you could append it to the current hit and > use CSS relative positioning. > > - ricardo > > On Oct 21, 7:53 am, Brandnew wrote: > > > Hello, > > > Here's what I've made. I have a lot of divs on different pages which > > you can Digg (it's called hit). When I click on hit, I've made a code > > that send Ajax data to a second page which record everything needed in > > the database. That's working easily. But then, I need to add something > > to that and I can't. I need to update the number of diggs and add 1 > > when task is complete and I need also to add it just in one div. I > > also have a little message showing up but that's not necessary for > > now. > > > Here's my JS script > > > $('.hit').each(function(){ > > $(this).click(function(){ > > var id=this.id; > > > $.post('../../posts/hit.php', > > {id:id}, function (responseText){ > > if (responseText == 1){ > > > $ > > ('#responseSuccess').slideDown(1000).fadeOut(4000); > > > } > > }) > > return false; > > }) > > }) > > > And here's my code where the html is > > > Hit > > > > ' . > > $donnees['hit'] . ' )';?> > > > I probably put too much span and stuff but I tried several things. THe > > fact is it never updates just the number of diggs (hits) on the actual > > div but on all of them. Or when I had a message id="responseText" it > > always shows at the same place even if he updates the good id. > > > Well, I hope I'm clear. I'm not really good at JS so I just try to > > work things out. > > > Thanks in advance, > > > Ced
[jQuery] Re: Best way to do this for multiple input fields?
I'm not 100% clear on what you are trying to accomplish but you can select items by what an attribute "starts with" http://docs.jquery.com/Selectors/attributeStartsWith#attributevalue so $("input[id^='item']") would get all your items regardless of how many there are On Dec 18, 5:21 pm, "Carlo Landmeter" wrote: > Hi, > > I'm trying to create a form with multiple input fields. These fields should > have a button to be able to check its content with .ajax. > I am able to create this function for a single field, but i don't know what > the best way would be to do it for multiple input fields: > > input#item0 > input#item1 > input#item2 > input#item3 > . > > What would be the best way to create this with jquery so i can adjust a > single var to create if for x items? > > Thx, > > Carlo > > $(document).ready(function(){ > $("span#check0").click(function(event){ > $("input#item0").ajaxStart(function(){ > $(this).addClass("loading"); > }); > $("input#item0").ajaxStop(function(){ > $(this).removeClass("loading"); > }); > $.ajax({ > type: "GET", > url: "checkitem.php", > data: { > 'sn': $('input#item0').val()}, > 'success': function(msg) { > if (msg == 'OK') > {$("input#item0").removeClass("nowarranty").addClass("warranty");} > if (msg == 'NG') > {$("input#item0").removeClass("warranty").addClass("nowarranty");} > }, > 'error': function() {alert('Error: please try again');} > }); > }); > > });
[jQuery] Superfish: IE6 Links in drop down fail to work
Hello All, Very odd behavior in IE6 that is driving me crazy. http://ymf.org Take a look at the drop down menus in IE6 (work fine in FF, Safari, IE7). Can't get the links to work at all in the drop down, except for the last link in the Programs section - Wells Fargo. I've tried removing the various divs below the navigation bar but the menu continues to fail. I've play with various z-index settings but, others than managing to stop IE6 from settling the menu's behind the lower portion of the page, the links don't come to life. What is really, really odd is how that single last link works. Should be a clue to the problem. But I'm flummoxed. Any ideas anyone? Thanks in advance!
[jQuery] Re: jQuery date picker - how to disable all Sunday
Hi Daniel Sorry I did not reply sooner with a thanks. I just found your email today in my inbox. I was wondering, where would I enter the info your provided? > $(".selector").datepicker({ beforeShowDay: $.datepicker.noWeekends }) > Yes, I do want to disable all weekends. Thank you again for your help. Best regards, Phil On Sun, Nov 23, 2008 at 12:28 PM, Daniel wrote: > > Hi plee, > > to disable all Sunday: > > javascript: > $('#noSunday').datepicker({ >beforeShowDay: noSunday, >showOn: "both", >buttonImage: "templates/images/calendar.gif", >buttonImageOnly: true > }); > > function noSunday(date){ > var day = date.getDay(); > return [(day > 0), '']; > }; > > To disable any Saturday and Sunday , I assumed that you want to > disable all Saturday and Sunday , in this case , you can use the built- > in noWeekends option: > > $(".selector").datepicker({ beforeShowDay: $.datepicker.noWeekends }) > > > On Nov 23, 11:59 pm, plee wrote: > > Hello > > > > Thank you for the jQuery date picker. > > > > Is there a way to disable all Sunday or any Saturday and Sunday? > > > > Thank you for everyone who has contributed. > > > > Best regards >
[jQuery] Re: Fetch (ajax) a file only if it's been modified
> OK, I think I got it (it was more code than I had thought it would > be). This does seem to be working. > > On initial load, I get a status 200, then wait a while and it cycles > through 304s (nothing new to fetch). Cause a change to my test.txt > file on the server and the next time it fetches the new version with a > 200 status. Wait a while and it cycles through 304s (nothing new to > fetch). Cause another change to my test.txt file on the server and it > fetches the new version with a 200 status. Rinse and repeat. > > Does this look proper to you guys? Well, typically you'd accomplish all this through server configuration files and/or .htaccess, not through php. You're doing it the hard way, but if it works, well then good on you. Mike
[jQuery] Re: Placing .get method results in a div tag
jQuery("#results").html(data); or: jQuery("#results").append(data); On Fri, Dec 19, 2008 at 10:56 AM, evanbu...@gmail.com wrote: > > Hi > > I've been using jQuery all of about 12 hrs now. I want to place the > results I get back from results.aspx into the div "results" rather > than alert it out. Thanks. > > > > function addNumbers() { > var number1 = $('#number1').attr('value'); > var number2 = $('#number2').attr('value'); >$.get("results.aspx", { number1: number1, number2: > number2 }, >function(data){ >alert("Data Loaded: " + data); >// want to place data value in results div here >}); >} > > > + id="number2" value="0" /> > > > >
[jQuery] clueTip + Perl bombing in IE7
New jQuery/clueTip user here. I am trying to use clueTip with Perl to create tooltips with previews of specific sections from the middle of their pages. I'm coding the rel attribute of the links to point to a Perl script plus parameters, like this: Extract.pl is supposed to take the parameters, open the page, create an excerpt starting at the anchor, and then print it out as html, which then gets displayed by the clueTip. This works fine in FireFox, but it completely fails in IE7 and IE6--it just displays a completely empty tooltip, without even the "contents could not be loaded" message. This is my jQuery code: $('a.basic').cluetip({ showTitle: false, ajaxCache: true, leftOffset: 25, width: 175, ajaxSettings: { dataType: 'html' } }); I realize I'm probably missing something very obvious, but if somebody could help me out, I'd really appreciate it.
[jQuery] Re: problems with async in IE but not mozilla
I am having the same problem I think (apologies if I accidentally posted twice). The standard jquery call seems to work fine. I haven't broken this down into a simple page yet that I could try with FireFox, but I will do that next. I'm in IE6&7 // This never calls my WebMethod... $("#navigation").treeview({ persist: "location", collapsed: true, unique: false, ajax: { url: "SearchResults.aspx/GetData", type: "POST", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json" } }); // This does var x = $.ajax({type:"POST", url: "SearchResults.aspx/GetData", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json" }); alert(x); On Dec 18, 1:55 pm, paulcurtis wrote: > As i mentioned the Mozilla Firefox browser runs the page perfectly (i > have firebug too). But the exact same page does not work in IE 7 or IE > 6 and when i say doesn't work it doesn't load the treeview using the > JSON data. A normal treeview does work. However on the same page as > this test i load the JSON data into a div via .load and that works > across all browsers. > > So this is the exact same page in Firefox vs IE. One works as expected > and one doesn't. > > Is there anything in IE i can do to find out what is happening? > > It is something to do specifically with treeview. filetree does work > okay (but doesn't do exactly what i need it to do...) > > thanks > paul > > On Dec 18, 7:16 pm, MorningZ wrote: > > > How about using Firefox (and more importantly Firebug) from Studio > > (right click on aspx file, choose "Browse With"), to make sure all > > libraries are getting loaded > > > On Dec 18, 1:28 pm, paulcurtis wrote: > > > > Hi, > > > > I really can't work this out. Im testing the async version of > > > treeview, just retrieving JSON from a static file for the time being. > > > > I have it set up in visual studio, running on the in built development > > > server. I have an aspx file and a plain htm file containing the JSON. > > > (I've deconstructed my real project down to this simple test case) > > > > I cannot get the treeview to work (retrieve the json) from IE 7 but > > > the exact same setup works fine in mozilla. > > > > If i run the set up based on the demo from my local file system within > > > IE i get a message about active x and scripting and it works fine. > > > (that's just html files) > > > > So this is only from visual studio (via built in development server) > > > and just IE. I assume it's some kind of security settings within IE > > > but i've tried every combination i can think off. From trusted sites > > > to lowering all security. > > > > Has anyone seen anything similar? Or might point me in the right > > > direction, it's driving me nuts! > > > > cheers > > > paul- Hide quoted text - > > > - Show quoted text -
[jQuery] Best way to do this for multiple input fields?
Hi, I'm trying to create a form with multiple input fields. These fields should have a button to be able to check its content with .ajax. I am able to create this function for a single field, but i don't know what the best way would be to do it for multiple input fields: input#item0 input#item1 input#item2 input#item3 . What would be the best way to create this with jquery so i can adjust a single var to create if for x items? Thx, Carlo $(document).ready(function(){ $("span#check0").click(function(event){ $("input#item0").ajaxStart(function(){ $(this).addClass("loading"); }); $("input#item0").ajaxStop(function(){ $(this).removeClass("loading"); }); $.ajax({ type: "GET", url: "checkitem.php", data: { 'sn': $('input#item0').val()}, 'success': function(msg) { if (msg == 'OK') {$("input#item0").removeClass("nowarranty").addClass("warranty");} if (msg == 'NG') {$("input#item0").removeClass("warranty").addClass("nowarranty");} }, 'error': function() {alert('Error: please try again');} }); }); });
[jQuery] Placing .get method results in a div tag
Hi I've been using jQuery all of about 12 hrs now. I want to place the results I get back from results.aspx into the div "results" rather than alert it out. Thanks. function addNumbers() { var number1 = $('#number1').attr('value'); var number2 = $('#number2').attr('value'); $.get("results.aspx", { number1: number1, number2: number2 }, function(data){ alert("Data Loaded: " + data); // want to place data value in results div here }); } +
[jQuery] Re: ASP.NET C# jquery treeview
I also have not been able to get the async portion of jquery TreeView plug in working in ASP.NET. My WebMethod is returning data just fine. Not sure what I'm doing wrong. I can call my WebMethod just fine outside of the treeview... //var x = $.ajax({type:"POST", //url: "SearchResults.aspx/GetData", //data: "{}", //contentType: "application/json; charset=utf-8", //dataType: "json" //}); //alert(x); But when I try to do something like this, it doesn't call my method. $("#navigation").treeview({ persist: "location", collapsed: true, unique: false, ajax: { url: "SearchResults.aspx/GetData", type: "POST", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success:function(json){x=json;} } }); On Nov 18, 12:40 pm, George wrote: > 1. Check if you hit this URl with a browser what happens... > > 2. ASP.NET embeds securite measures into what can be POSTed to ASP.NET > page. > in web.config set > > 3. Please see my > POSThttp://groups.google.com/group/jquery-en/browse_thread/thread/a2f65e2... > Your method might have problems. You need to read InputStream > completelly > > George. > > On Nov 18, 2:14 pm, mthakershi wrote: > > > Well.. I understand that. But it doesn't look that simple. I am not > > able to get the tree view example to work with ASP.NET. Here is the > > post I wrote in one other forum. Please see if you can help. > > > Hello, I am not able to get this sample to work. It is driving me > > crazy. I think it is about setting up environment because it is not > > even calling the server-side page in debug mode. Please help. > > > I have included necessary jQuery files in my project. I am right now > > trying on a sample page. > > > Here is my HTML page: > > > 1 <%@ Page Language="C#" AutoEventWireup="true" > > CodeBehind="SampleJson.aspx.cs" Inherits="TeleHealth.SampleJson" %> > > 2 > > 3 > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > > 4 http://www.w3.org/1999/xhtml";> > > 5 > > 6 Untitled Page > > 7 > rel="stylesheet" type="text/css" /> > > 8 > > 9 > > 10 > > 11 > > 12 > > 13 > > 14 > > 15 > > 16 > > 17 > > 18 > > 19 function initTrees() { > > 20 $("#black").treeview({ > > 21 url: "GetTreeData.aspx" > > 22 }) > > 23 > > 24 $("#mixed").treeview({ > > 25 url: "GetTreeData.aspx", > > 26 // add some additional, dynamic data and request > > with POST > > 27 ajax: { > > 28 data: { > > 29 "additional": function() { > > 30 return "yeah: " + new Date; > > 31 } > > 32 }, > > 33 type: "post", > > 34 data: "{}", > > 35 contentType: "application/json; charset=utf-8", > > 36 dataType: "json" > > 37 } > > 38 }); > > 39 } > > 40 > > 41 $(document).ready(function(){ > > 42 initTrees(); > > 43 }); > > 44 > > 45 > > 46 > > 47 > > 48 > > 49 Lazy-loading tree > > 50 > > 51 > > 52 > > 53 Mixed > > 54 > > 55 Item 1 > > 56 > > 57 Item 1.0 > > 58 > > 59 Item 1.0.0 > > 60 > > 61 > > 62 Item 1.1 > > 63 > > 64 > > 65 Item 2 > > 66 > > 67 > > 68 > > 69 > > 70 Item 3 > > 71 > > 72 > > 73 > > 74 > > > Here is my server-side code: > > > 1 namespace TeleHealth > > 2 { > > 3 public partial class GetTreeData : System.Web.UI.Page > > 4 { > > 5 protected void Page_Load(object sender, EventArgs e) > > 6 { > > 7 string pStrReply = "[ { \"text\": \"1. > > Review of > > existing structures\", \"expanded\": true, > > \"children\": [ { > > \"text\": \"1.1 jQuery core\" }, > > { \"text\": \"1.2 metaplugins > > \" } ] }, { > > \"text\": \"2. Wrapper plugins\" }, { \"text\": \"3. > > Summary\" }, { \"text\": \"4. Questions and answers\" > >
[jQuery] Re: syntax for $(response).$('a').each()
Try this instead: $('a', data).click(function(){ var href = $(this).attr('href'); [etc...] }); When using $('a', data).attr('onclick', 'javascript:your code goes here'); the 2nd parameter should be a string, as if you were doing foo On Dec 18, 12:55 pm, Namotco wrote: > Here is what I'm trying to do: > $("#MTB").load(url +" #content", function(data) { > $("a", data).attr("onclick",function (arr) > { > var href=this.attr('href'); > if (href.match('string') ) {return > "getMTB > (this.href); return false;"; } else { return 'alert(this.href); return > false;' ;} > }); > }); > It doesn't seem to work though
[jQuery] Re: multiple checkboxes showing/hiding a div
thanks Dave and Ricardo! On Dec 18, 12:00 am, Ricardo Tomasi wrote: > var $check = $(':checkbox'); > $check.change(function(){ > $('#special')[ $check.attr('checked') ? 'show' : 'hide' ]('slow'); > > }); > > that's essentially the same as > > $check.attr('checked') ? $('special').show('slow') : $('special').hide > ('slow'); > > (which is an if/else). And you don't need the IDs on the inputs. > > - ricardo > > On Dec 18, 12:58 am, "krozi...@gmail.com" wrote: > > > Folks, > > > I have two checkboxes. When either one is checked, I would like to > > show a div. When both are not checked, then I want the div hidden. > > However, I've only been able to use toggle to show and hide the div > > only when checking/unchecking one checkbox. It's not quite what I > > need. So far I have this: > > > js: > > $("#check_1").click(function(){ $("#special").toggle("slow"); }); > > $("#check_2").click(function(){ $("#special").toggle("slow"); }); > > > html: > > One > > > > > > > > Two > > > > > Some special stuff... > > > > > Any help would be appreciated. > > > Thanks, > > Konstantin
[jQuery] Re: .html() and ampersand
use .text() if you're looking to return a string of text only rather than html. And by value of a label, you do mean what goes in here right? On Dec 18, 5:41 pm, "graphic...@googlemail.com" wrote: > Hi, > > I use the .html() function to get the value of a label, but when it > contains an ampersand (&) it is converted to & amp ; > > How can I prevent that or is there another way of getting the value of > the label ? > > Thanks
[jQuery] Re: history plugin
I have written a code ( => just for myself usage) that makes links bookmarks like this example: you are on : "http://www.mysite.com/index.php"; you click a link like "sitemap.php" it will be load and you will see "http://www.mysite.com/ index.php#sitemap" or if you click "myfile.php?id=3&p=test" it load and you will see "http://www.mysite.com/index.php#myfile:id=6/ p=test/" this code dosn't change any anchor href and i think this is why this code is better than others for me ( for seo ) you can see the example on " http://www.giftcenter.ir " and js file on : "http://www.giftcenter.ir/templates/Gift/js/js.js"; $(document).ready(function(){ $("a").livequery('click',function(){ var h = $(this).attr("href"); history(h); $.get(h,function(){} ); }); }); var getHash = function(myHash){ h = myHash; if ( h.length < 1) h = 'index'; if ( h.indexOf(':') > 0 ){ h = h.replace(/^#/,'').replace(':','.php?'); while( h.indexOf('/') > 0 ) h = h.replace ('/','&'); }else { h = h.replace(/^#/,''); h += '.php'; } // this line will run when you have load a page before and now you are refreshing the page $.get(h,{'ajax_check':'true'},function(data){$body.html ('' +data + '');}); if($.browser.msie) _loadedHash = _historyIframe.contentWindow.document.location.hash; else _loadedHash = myHash; }; if ($.browser.msie) { var _historyIframe = $('').appendTo("BODY").get(0); var iframe = _historyIframe.contentWindow.document; iframe.open(); iframe.close(); setInterval(function(){ var h = _historyIframe.contentWindow.document.location.hash; if ( (_loadedHash != null) && ( _loadedHash ! = h) )getHash(h); }, 500); } else if ($.browser.mozilla) { setInterval(function(){ if ( (_loadedHash != null) && ( _loadedHash != location.hash) ) getHash(location.hash); }, 500); } try{ if(location.hash.length > 0 && !$.browser.msie) getHash(location.hash); }catch(e){ alert(e.name + ' ' + e.message); } var history = function(path){ var qmp = (path.indexOf('?') > 0 ) ? path.indexOf('?') + 1 : path.length + 1; var lp = path.length; var fileNameP1 = path.indexOf('.php') + 1; var fileNameP2 = (qmp > 1) ? qmp-1 : path.length; var params = path.substring(qmp,lp); var newPath = ''; var fileName = path.substring( path.substring (0,fileNameP2).lastIndexOf('/')+1 , fileNameP2 ).replace('.php',''); if (params.length > 0 ){ var a = explodeArray(params,"&"); for (var i=0, j=a.length; i wrote: > Hello, I was wondering if anyone has successfully combined jQuery ajax > calls with a browser history plugin. I have seen lots of older posts, > and lots of older libraries, but not many examples for a current, > cross-browser solution. I have tried using Really Simple History > (http://code.google.com/p/reallysimplehistory/), and while it does add > the anchor pages to my history, the content remains the same when > going forward / backward. I also tried the JSSM plugin (http:// > trac.nathanhammond.com/jssm/), I had to hack it up a little bit since > it tries to be all-in-one, but I had the same problems with it as with > RSH (history is there, but it doesnt do anything). > > The history plugins listed in the jQuery plugins directory I have also > tried and the are either old, not up-to-date with current browsers, or > not fully functional. > > Does anyone have a working example that they could point me to? Any > advice on how to integrate with one of the plugins I mentioned? Any > ideas as to why the history is there, but the page content does not > change? > > Here are the ajax calls I would like to create a history for: > > > function ajaxMenu() { > $("#accordion .ui-accordion-data a").click(function(event) { > event.preventDefault(); > $(".userTool").html("").append(" class='loading' > style='margin-top:7em;'>"); > var url = $(this).attr("href"); > if(url.indexOf("?") == -1) { > url = url + '?'; > } else { > url = url + '&'; > } > url = url + 'ajax=true&skipNavigation=true'; > $.ajax({ > url: url, > complete: function(XMLHttpRequest, textStatus) { >
[jQuery] .html() and ampersand
Hi, I use the .html() function to get the value of a label, but when it contains an ampersand (&) it is converted to & amp ; How can I prevent that or is there another way of getting the value of the label ? Thanks
[jQuery] Re: JQ Modal IE6 and 7 issues
Hello, Thanks for you help. I did this and it does work in ie6 and 7, however, now when I close the modal box in any browser, it shifts... view it here: http://www.zero1productions.com/inacronym/preview/profile.php How do I fix this? MorningZ wrote: > > > Try using the "topTop" Parameter > > $('#div1').jqm({ toTop: true }); > > > > On Dec 17, 9:16 am, jive01 wrote: >> Not sure what is wrong... Works great in Firefox: >> >> http://www.zero1productions.com/inacronym/preview/profile.php >> >> (please click on the my people tab and then click the first "+" sign on >> the >> first photo and the jq modal box will pop up). >> >> In IE6 and 7 everything else is not clickable on the site... Please help! >> -- >> View this message in >> context:http://www.nabble.com/JQ-Modal-IE6-and-7-issues-tp21019899s27240p2101... >> Sent from the jQuery General Discussion mailing list archive at >> Nabble.com. > > -- View this message in context: http://www.nabble.com/JQ-Modal-IE6-and-7-issues-tp21019899s27240p21082328.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: problems with async in IE but not mozilla
Ah, i wasn't sure that you tried FF using Studio's web server, that wasn't clear Not sure what else to offer except that in studio, the web server (and the application) "run as" your logged in account where IIS is not doing so unless setup that way.. so i'd take a guess that it was a file-permission based problem. On Dec 18, 4:55 pm, paulcurtis wrote: > As i mentioned the Mozilla Firefox browser runs the page perfectly (i > have firebug too). But the exact same page does not work in IE 7 or IE > 6 and when i say doesn't work it doesn't load the treeview using the > JSON data. A normal treeview does work. However on the same page as > this test i load the JSON data into a div via .load and that works > across all browsers. > > So this is the exact same page in Firefox vs IE. One works as expected > and one doesn't. > > Is there anything in IE i can do to find out what is happening? > > It is something to do specifically with treeview. filetree does work > okay (but doesn't do exactly what i need it to do...) > > thanks > paul > > On Dec 18, 7:16 pm, MorningZ wrote: > > > How about using Firefox (and more importantly Firebug) from Studio > > (right click on aspx file, choose "Browse With"), to make sure all > > libraries are getting loaded > > > On Dec 18, 1:28 pm, paulcurtis wrote: > > > > Hi, > > > > I really can't work this out. Im testing the async version of > > > treeview, just retrieving JSON from a static file for the time being. > > > > I have it set up in visual studio, running on the in built development > > > server. I have an aspx file and a plain htm file containing the JSON. > > > (I've deconstructed my real project down to this simple test case) > > > > I cannot get the treeview to work (retrieve the json) from IE 7 but > > > the exact same setup works fine in mozilla. > > > > If i run the set up based on the demo from my local file system within > > > IE i get a message about active x and scripting and it works fine. > > > (that's just html files) > > > > So this is only from visual studio (via built in development server) > > > and just IE. I assume it's some kind of security settings within IE > > > but i've tried every combination i can think off. From trusted sites > > > to lowering all security. > > > > Has anyone seen anything similar? Or might point me in the right > > > direction, it's driving me nuts! > > > > cheers > > > paul- Hide quoted text - > > > - Show quoted text -
[jQuery] Re: problems with async in IE but not mozilla
As i mentioned the Mozilla Firefox browser runs the page perfectly (i have firebug too). But the exact same page does not work in IE 7 or IE 6 and when i say doesn't work it doesn't load the treeview using the JSON data. A normal treeview does work. However on the same page as this test i load the JSON data into a div via .load and that works across all browsers. So this is the exact same page in Firefox vs IE. One works as expected and one doesn't. Is there anything in IE i can do to find out what is happening? It is something to do specifically with treeview. filetree does work okay (but doesn't do exactly what i need it to do...) thanks paul On Dec 18, 7:16 pm, MorningZ wrote: > How about using Firefox (and more importantly Firebug) from Studio > (right click on aspx file, choose "Browse With"), to make sure all > libraries are getting loaded > > On Dec 18, 1:28 pm, paulcurtis wrote: > > > > > Hi, > > > I really can't work this out. Im testing the async version of > > treeview, just retrieving JSON from a static file for the time being. > > > I have it set up in visual studio, running on the in built development > > server. I have an aspx file and a plain htm file containing the JSON. > > (I've deconstructed my real project down to this simple test case) > > > I cannot get the treeview to work (retrieve the json) from IE 7 but > > the exact same setup works fine in mozilla. > > > If i run the set up based on the demo from my local file system within > > IE i get a message about active x and scripting and it works fine. > > (that's just html files) > > > So this is only from visual studio (via built in development server) > > and just IE. I assume it's some kind of security settings within IE > > but i've tried every combination i can think off. From trusted sites > > to lowering all security. > > > Has anyone seen anything similar? Or might point me in the right > > direction, it's driving me nuts! > > > cheers > > paul- Hide quoted text - > > - Show quoted text -
[jQuery] script tags in Ajax request
How do I disable reading/eval script tags in a request?
[jQuery] Re: Searching for the previous sibling that matches a condition
FYI, my if statement was actually doing exactly what it was supposed to. The bug was inside the body of the if (I didn't post that :-(). Long story short, I was confused. Basically prev and next are smarter than I thought they were :-). For what it's worth, my updated code is below. Basically what's going on is that I've got header rows and detail rows. When I delete the detail row I check to see if it is the last one for its header, and if so, delete the header. I may still yet be doing it the hard way, but at least it works in Firefox now. Thanks Karl and ricardobeat for your help. if ($(theTr).prev("tr").is(".headerrow") && ($(theTr).next("tr").is(".headerrow") || $(theTr).is("tr:last- child"))) { $(theTr).prev("tr").remove(); } $(theTr).remove(); On Nov 20, 12:21 pm, ricardobeat wrote: > Would that be a in the way? Try putting it there yourself, > this should avoid the problem: > > > > > > > > > > > > > On Nov 19, 11:57 pm,go_dores wrote: > > > > > First of all, I'm just getting started with jQuery so thanks in > > advance for your patience. I have a table that I am manipulating and > > I need to remove a row under a certain condition. I originally wrote > > the test below: > > > if (theTr.previousSibling && theTr.previousSibling.className == > > "headerrow" && > > (!theTr.nextSibling || theTr.nextSibling.className == "headerrow")) > > > In English, I have a tr element stored in the variable theTr. I am > > testing for the case where its previous and next siblings have a > > certain CSS class. > > > This code works fine on IE and Safari, but does not work on Firefox. > > It look like in Firefox the tr's have extra text node siblings in > > between them. What I would like to do to fix this is to find a jQuery > > expression that will allow me to do this in a cleaner way. So what I > > need is an expression that will search backward for the first tr > > sibling, and forward for the first tr sibling, skipping over the extra > > gunk that seems to be there with Firefox. > > > Here was my last stab at this before I gave up and decided to ask for > > help :-). The problem with the code below is that it seems to be > > looking at the immediate previous element and checking to see if it's > > a tr, and of course that is false in Firefox. > > > if ($(theTr).prev("tr").is(".departmentrow") && > > ($(theTr).next("tr").is(".departmentrow") || $(theTr).is("tr:last- > > child"))) > > > Long story short, what's the best way to do a search like this? Any > > pointers would be appreciated.- Hide quoted text - > > - Show quoted text -
[jQuery] Re: history plugin
I need to implement this myself. I noticed today that there is a jQuery UI history planned: http://docs.jquery.com/UI/Roadmap Does anyone know if work has started on this?
[jQuery] Superfish dropup?
I love this menu system... but now I have a project that I need to set the menu at the bottom... so the dropdowns no need to be dropUps... I have be working at this with no luck. Any one know how to have the menu drop upwards? Thanks for the help...
[jQuery] Re: Superfish
Odd this appended to NOX post lol... I'll repost correctly On Dec 18, 12:53 pm, jeremyBass wrote: > I love this menu system... but now I have a project that I need to set > the menu at the bottom... so the dropdowns no need to be dropUps... I > have be working at this with no luck. Any one know how to have the > menu drop upwards? Thanks for the help... > > jeremyBass
[jQuery] Re: Dynamic form validation on different names possible?
Thanks Jörn I'll give it a try! On Dec 18, 12:17 pm, "Jörn Zaefferer" wrote: > You could generate the rules object. > > var rules = {}; > $(":input[name*=date-start"]).each(function() { > rules[this.name] = { ... }}); > > $("...").validate({options:rules}); > > Jörn > > On Thu, Dec 18, 2008 at 3:01 PM,dfiguero wrote: > > > Hi, > > > I'm trying to validate a form with a dynamic date fields. Something > > like: > > > > > > > > value="Mar. 29, 2008" /> > > > > > > > > > > > > > value="Jun. 02, 2010" /> > > > > > > > > ... > > > > > > > value="aaa. 99, " /> > > > > > > > > > I got my validation rules working but only if I hardcode each of the > > input's names: > > > $("form").validate({ > > rules: { > > "date-1-start": compare ["#date_1-start","#date_1-end"], > > "date-2-start": compare ["#date_2-start","#date_2-end"], > > ... > > "date-n-start": compare ["#date_n-start","#date_n-end"] > > } > > }); > > > Would there be a way to dynamically generate the rules? Something > > like: > > > $("form").validate({ > > rules: { > > $(":input[name*=date-start"]): compare [$(":input[name*=date- > > start"]),$(":input[name*=date-end"])], > > } > > }); > > > I know I could perhaps do this by adding classes to the input fields > > but I would prefer avoiding that option. > > > Thanks > >
[jQuery] Losing link in an Image Gallery
I am new to jquery, but am really excited about it. I have managed to hack together several scripts to accomplish what my designers want but have hit a wall. I have an Image Gallery that also uses Shadowbox.js by Michael Jackson. Basically there are thumbnail which change a main image and the main image can be enlarged further using Shadowbox.js. The problem is that I can only get the initial image to work with Shadowbox.js. Once I change the main image I lose my link and I do not understand Jquery enough yet to figure out why. Here is a link for an example http://site.jpda.biz/projects/boerum-hill-house Here is the current code snip $(function() { $("#imageOptions a").click(function() { var imageSource = $(this).children("img").attr("id"); $("#loader").addClass("loading"); $("h3").remove(); showImage(imageSource); return false; }); }); function showImage(src) { $("#loader img").fadeOut("slow") .remove(); var largeImage = new Image(); $(largeImage).attr("src", src) .attr("id", "main") .load(function() { $(largeImage).hide(); $("#loader").removeClass("loading") .append(largeImage); $(largeImage).fadeIn("slow"); $("#loader img").click(function() { alert("Launch Shadowbox here"); }); }); }
[jQuery] Superfish
I love this menu system... but now I have a project that I need to set the menu at the bottom... so the dropdowns no need to be dropUps... I have be working at this with no luck. Any one know how to have the menu drop upwards? Thanks for the help... jeremyBass
[jQuery] Does with_plugins work when building jQuery from the Makefile?
In the Makefile, I noticed a with_plugins target. However, the command: make with_plugins results in the following error: make: *** No rule to make target `../plugins/button/*', needed by `with_plugins'. Stop. What's the appropriate way to use with_plugins? I'd like to build jquery with some of the plugins mentioned in the Makefile so that a bazillion JS files don't need to be downloaded (which slows down my site). I could add that to the build process for the website, but was wondering if there's a jquery Makefile solutions. Thanks!
[jQuery] Re: Need Help with my plugin
OK, so I'm nearing the final stages with this project. Here's what I have, and what I need. Hopefully someone can help me here because I'm at a point where I can't test certain things. When an image is selected from the thumbnails, I have a script that resizes the image to 50% viewport size and finds the center. From there the gallery tests for the viewport center and lines up the image so that it is centered on the page. It appears that the image resize works well in all browsers. However, I'm having some problems with centering the image. It works in FF3 (on Linux and WinXP) and I am told IE7. However, I can't determine whether or not it is working in IE6. I have downloaded IEs4Linux to try to see it on my own box, but it is a very dumbed down version of IE so I don't know if my problems are because of that or because it doesn't work in 6. However, from what I can see on my version, IE6 is placing the image full right instead of center. Another problem in IE (both 6 and 7) is that the previous and next image buttons are not visible, even though the methods work correctly as we still have keyboard navigation. Yet another problem(possibly) is another small plugin I wrote to try and fix IE6 png rendering problems. The plugin searches out image elements and any element in the DOM with a png background and applies the microsoft filter to correct transparency. I know it is doing everything it is supposed to do up to actually working. I set it up to alert me with the src for each png found on the page and it found each one. However, since I have no reliable IE6 to test this on I can't tell if it is loading the filters and rendering the pngs correctly. As a side note, this is still trying to add the filter to all browsers (no sniffing involved just yet), but firebug doesn't display the css rule. This could be because FF doesn't use the microsoft filters because when I hard coded the filter into the css, it didn't display the filter property value either. http://wbweddings.thruhere.net is the site in question. Any help would be greatly appreciated. Thanks in advance.
[jQuery] Re: Browser Hangs while hiding 2K+ table rows
It seems the overhead of hide/show() is too great for that situation. $allRows.css('display','none') gives good performance from the start. On Dec 18, 4:28 pm, RickyBerg wrote: > I've been converting a legacy web app to use JQuery. I've now cleaned > it up so that my HTML validates and I have instrumented the code with > classes and id's as appropriate. This app is essentially a table that > displays the status of jobs for Autosys. > > The problem that I'm having is that when I hide the entire list, the > browser hangs for several minutes. > > There are sometimes over 2000 rows. I have cached the full resultset > into a variable, though I'm not sure how helpful this is. > > In the code below, the initial setting of $allRows doesn't take much > time at all, but when I hit the hide() line, the browser hangs for > wy too long. interestingly, if I comment out the hide() command, > and then manually issue a comand like $allRows.css("color", "red"); it > works in a very reasonable amount of time. > > $(function() { > $allRows = $("tbody>tr"); > $allRows.hide(); > > } > > Also, if I let it run once to completion and all of the rows are > hidden, then I can show() them and hide() them in reasonable time. > > Is it something with my selector? > > Thanks, folks. > > Eric
[jQuery] history plugin
Hello, I was wondering if anyone has successfully combined jQuery ajax calls with a browser history plugin. I have seen lots of older posts, and lots of older libraries, but not many examples for a current, cross-browser solution. I have tried using Really Simple History (http://code.google.com/p/reallysimplehistory/), and while it does add the anchor pages to my history, the content remains the same when going forward / backward. I also tried the JSSM plugin (http:// trac.nathanhammond.com/jssm/), I had to hack it up a little bit since it tries to be all-in-one, but I had the same problems with it as with RSH (history is there, but it doesnt do anything). The history plugins listed in the jQuery plugins directory I have also tried and the are either old, not up-to-date with current browsers, or not fully functional. Does anyone have a working example that they could point me to? Any advice on how to integrate with one of the plugins I mentioned? Any ideas as to why the history is there, but the page content does not change? Here are the ajax calls I would like to create a history for: function ajaxMenu() { $("#accordion .ui-accordion-data a").click(function(event) { event.preventDefault(); $(".userTool").html("").append(""); var url = $(this).attr("href"); if(url.indexOf("?") == -1) { url = url + '?'; } else { url = url + '&'; } url = url + 'ajax=true&skipNavigation=true'; $.ajax({ url: url, complete: function(XMLHttpRequest, textStatus) { $(".userTool").replaceWith(XMLHttpRequest.responseText); $(".filtered",".userTool").columnFilters(); } }); $("#accordion .ui-accordion-data a").removeClass("current"); $(this).addClass("current"); }); }
[jQuery] building jquery from Makefile using with_plugins target
In the Makefile for jquery, I noticed there's a "with_plugins" target. Does anyone know what this is for? When I try building with the command: make with_plugins I get the error: make: *** No rule to make target `../plugins/button/*', needed by `with_plugins'. Stop. I need quite a few of the plugins referenced in the Makefile. I'm hoping that there's a way to build jquery so that a single JS file contains jquery and the plugins referenced in the Makefile. This would be helpful so that my site doesn't need to download a gazillion JS files. Although I could adapt the build process for my site to concatenate the files, it'd be nice to build a custom version of jquery that has everything I need. Thanks! =theo
[jQuery] Superfish, Submenu not appearing on page load
Hi All, First of thanks for this awesome script... I am have a bit of a difficulty witht he nav-bar confgiuration; On the examples page (http://users.tpg.com.au/j_birch/plugins/ superfish/#sample4), the nav-bar example automatically shows the "current" sub menu items on page load. However when I used the scripts locally on my own server, i couldn't get the code to automatically show the submenu items on page load. I have my sample up here: http://www.gameskore.com/test/example2.html Can any body help?
[jQuery] jQuery toggle menu help
I have created a toggle menu using this jQuery code. $(document).ready(function(){ var subs = $('.menu > ul ul'); subs.hide(); $('.menu > ul > li a').click(function(){ $(this).next('.menu > ul > li a').toggle(); }); }); A sample menu.. Category One Page1 Page2 Page3 Category Two Page1 Page2 Page3 Page4 I want to increase the functionality of the menu by having each category close when a new one is selected, I also want an active category to stay open when a page is open that belongs to the category. any help would be appreciated thanks.
[jQuery] Re: Fetch (ajax) a file only if it's been modified
big doh @ me, didn't notice t'was php. seems you already solved it anyway! On Dec 18, 5:49 pm, Ricardo Tomasi wrote: > If you have SSI enabled on your server the Last-modified header won't > be sent, it should be sent for all static pages. > > On Dec 18, 5:15 pm, Magnificent > > wrote: > > I'm making some progress, if I include the following: > > > > $last_modified = filemtime("test.txt"); > > header("Last-Modified: " . $last_modified); > > ?> > > > I get a response header with: > > Last-Modified 1229624249 > > > If I then wait a bit and make a change to cause test.txt to be > > updated, I get: > > > Last-Modified 1229627412 > > > So I'm definitely getting the Last-Modified header sent but all the > > responses still show up as 200. I should be getting 304s until > > test.txt is updated, then get one 200, then more 304s until test.txt > > is update again, right? > > > On Dec 18, 11:05 am, Mike Alsup wrote: > > > > > I take it back, my livedata_fetch.php is coming back with a 200 > > > > status, but I want it coming back with a 304 not modified, right? > > > > That means it'll only fetch the file if it's been updated since the > > > > last time it was fetched? > > > > Right. The server needs to set the Last-Modified header for this to > > > work correctly. If it does, jQuery will use that date/time in the If- > > > Modified-Since header. If the resource has not been modified then the > > > server should return an empty response body with a 304 status.
[jQuery] Re: Fetch (ajax) a file only if it's been modified
If you have SSI enabled on your server the Last-modified header won't be sent, it should be sent for all static pages. On Dec 18, 5:15 pm, Magnificent wrote: > I'm making some progress, if I include the following: > > $last_modified = filemtime("test.txt"); > header("Last-Modified: " . $last_modified); > ?> > > I get a response header with: > Last-Modified 1229624249 > > If I then wait a bit and make a change to cause test.txt to be > updated, I get: > > Last-Modified 1229627412 > > So I'm definitely getting the Last-Modified header sent but all the > responses still show up as 200. I should be getting 304s until > test.txt is updated, then get one 200, then more 304s until test.txt > is update again, right? > > On Dec 18, 11:05 am, Mike Alsup wrote: > > > > I take it back, my livedata_fetch.php is coming back with a 200 > > > status, but I want it coming back with a 304 not modified, right? > > > That means it'll only fetch the file if it's been updated since the > > > last time it was fetched? > > > Right. The server needs to set the Last-Modified header for this to > > work correctly. If it does, jQuery will use that date/time in the If- > > Modified-Since header. If the resource has not been modified then the > > server should return an empty response body with a 304 status.
[jQuery] Re: History Plugin
I have written a code ( => just for myself usage) that makes links bookmarks like this example: you are on : "http://www.mysite.com/index.php"; you click a link like "sitemap.php" it will be load and you will see "http://www.mysite.com/ index.php#sitemap" or if you click "myfile.php?id=3&p=test" it load and you will see "http://www.mysite.com/index.php#myfile:id=6/ p=test/" this code dosn't change any anchor href and i think this is why this code is better than others for me ( for seo ) you can see the example on " http://www.giftcenter.ir " and js file on : "http://www.giftcenter.ir/templates/Gift/js/js.js"; $(document).ready(function(){ $("a").livequery('click',function(){ var h = $(this).attr("href"); history(h); $.get(h,function(){} ); }); }); var getHash = function(myHash){ h = myHash; if ( h.length < 1) h = 'index'; if ( h.indexOf(':') > 0 ){ h = h.replace(/^#/,'').replace(':','.php?'); while( h.indexOf('/') > 0 ) h = h.replace('/','&'); } else { h = h.replace(/^#/,''); h += '.php'; } $.get(h,{'ajax_check':'true'},function(data){$body.html('' + data + '');}); if($.browser.msie) _loadedHash = _historyIframe.contentWindow.document.location.hash; else _loadedHash = myHash; }; if ($.browser.msie) { var _historyIframe = $('').appendTo("BODY").get(0); var iframe = _historyIframe.contentWindow.document; iframe.open(); iframe.close(); setInterval(function(){ var h = _historyIframe.contentWindow.document.location.hash; if ( (_loadedHash != null) && ( _loadedHash != h) ) getHash(h); }, 500); } else if ($.browser.mozilla) { setInterval(function(){ if ( (_loadedHash != null) && ( _loadedHash != location.hash) ) getHash(location.hash); }, 500); } try{ if(location.hash.length > 0 && !$.browser.msie) getHash(location.hash); }catch(e){ alert(e.name + ' ' + e.message); } var history = function(path){ var qmp = (path.indexOf('?') > 0 ) ? path.indexOf('?') + 1 : path.length + 1; var lp = path.length; var fileNameP1 = path.indexOf('.php') + 1; var fileNameP2 = (qmp > 1) ? qmp-1 : path.length; var params = path.substring(qmp,lp); var newPath = ''; var fileName = path.substring( path.substring (0,fileNameP2).lastIndexOf('/')+1 , fileNameP2 ).replace('.php',''); if (params.length > 0 ){ var a = explodeArray(params,"&"); for (var i=0, j=a.length; i wrote: > Dear Folks, > consider we have page A which has 4 links we filter these Links with > javascipt History Plugin which we have, as you can see in below > now Our History Plugin Works and it is Bookmarkable and everything is > Ok right now, > now consider each of these Links Do some Ajax Calls and Load Page B, > so we have to give these links the ability to be bookmarkable and > support History , so What I did is in to solve this problem , I used > Livequery plugin , so I added 1,2...link to it > and then Imported the History on it , but what accually happend ,Page > I'm working in Page A Links there is no Problem , but when I start to > click on the Page B links , > You know I could not get back , so page B history works for Page B > links , And Page A history works in Page A Links , > I think at the first because Page B is not Loaded to the System , It > can not realize what it is in it , so ... > this happens , I don't know what exactly to do , Just I want to make > Dynamic Portal with History support , Dear Karl,Mike Alsup, Jorn ... > guys Help ... > > > 1 > 2 > 3 > 4 > Ajax Contenct Comes here > > > > 5 > 6 > 7 > 8 > > > > > $(document).ready(function(){ > > $("#1,#2,#3,#4,#5,#6,#7,#8").livequery(function(){ > $(this).history(function() { alert($ (this).attr(''id)); $ > (this).load('pageb.php') }); > }); > $.ajaxHistory.initialize(); > > }); > > Regards Pedram > .
[jQuery] Re: Fetch (ajax) a file only if it's been modified
OK, I think I got it (it was more code than I had thought it would be). This does seem to be working. On initial load, I get a status 200, then wait a while and it cycles through 304s (nothing new to fetch). Cause a change to my test.txt file on the server and the next time it fetches the new version with a 200 status. Wait a while and it cycles through 304s (nothing new to fetch). Cause another change to my test.txt file on the server and it fetches the new version with a 200 status. Rinse and repeat. Does this look proper to you guys? On Dec 18, 11:15 am, Magnificent wrote: > I'm making some progress, if I include the following: > > $last_modified = filemtime("test.txt"); > header("Last-Modified: " . $last_modified); > ?> > > I get a response header with: > Last-Modified 1229624249 > > If I then wait a bit and make a change to cause test.txt to be > updated, I get: > > Last-Modified 1229627412 > > So I'm definitely getting the Last-Modified header sent but all the > responses still show up as 200. I should be getting 304s until > test.txt is updated, then get one 200, then more 304s until test.txt > is update again, right? > > On Dec 18, 11:05 am, Mike Alsup wrote: > > > > I take it back, my livedata_fetch.php is coming back with a 200 > > > status, but I want it coming back with a 304 not modified, right? > > > That means it'll only fetch the file if it's been updated since the > > > last time it was fetched? > > > Right. The server needs to set the Last-Modified header for this to > > work correctly. If it does, jQuery will use that date/time in the If- > > Modified-Since header. If the resource has not been modified then the > > server should return an empty response body with a 304 status.
[jQuery] invalid arg line 1121 in ie6
Hi, Is following psuedo syntax valid in jQuery? It is causing an error in ie6(invalid arg line 1121 in ie6): $(window).bind('load', function() { ... $('#headerNavLeft .special').each(function() { $('li:first', $('ul', $(this))).css('padding-left', (xPos-offset) +'px'); } }
[jQuery] Re: Browser Hangs while hiding 2K+ table rows
If you are trying to hide allrows would it be possible to hide either the table or the tbody? On Fri, Dec 19, 2008 at 7:28 AM, RickyBerg wrote: > > I've been converting a legacy web app to use JQuery. I've now cleaned > it up so that my HTML validates and I have instrumented the code with > classes and id's as appropriate. This app is essentially a table that > displays the status of jobs for Autosys. > > The problem that I'm having is that when I hide the entire list, the > browser hangs for several minutes. > > There are sometimes over 2000 rows. I have cached the full resultset > into a variable, though I'm not sure how helpful this is. > > In the code below, the initial setting of $allRows doesn't take much > time at all, but when I hit the hide() line, the browser hangs for > wy too long. interestingly, if I comment out the hide() command, > and then manually issue a comand like $allRows.css("color", "red"); it > works in a very reasonable amount of time. > > $(function() { >$allRows = $("tbody>tr"); >$allRows.hide(); > } > > Also, if I let it run once to completion and all of the rows are > hidden, then I can show() them and hide() them in reasonable time. > > Is it something with my selector? > > Thanks, folks. > > Eric >
[jQuery] Re: Pro Javascript Techniques Doubt
I mean the the getter/setter functions are the ones that doesn't get immediately executed. But if you're really new to this maybe you could start with something that's easier to digest, like Douglas Crockford's videos on YDN. I only say this because I also started to read this book (or was it the Pro JS Design Patterns?) when I knew next to nothing about javascript but it was quite frustrating experience then :) http://video.yahoo.com/search/?p=The+JavaScript+Programming+Language http://video.yahoo.com/search/?p=advanced+JavaScript On Dec 18, 7:45 pm, "pablo fernandez" wrote: > Yeah it sounds complicated... I'm kinda newbe to this, I hope you > don't mind if I ask these silly questions > > I thought the anonymous function got executed on this line > > for ( var i in properties ) { > > (function(){ > this[ "get" + i ] = function() { > return properties[i]; > }; > this[ "set" + i ] = function(val) { > properties[i] = val; > }; > }).call(this)--> EXECUTE! (and use actual value of i) > // now go on with the next i > ; } > > Isn't this the "logical" way of seeing it? what am I missing? > > On Thu, Dec 18, 2008 at 3:38 PM, Balazs Endresz > > > > wrote: > > > this[ "set" + i ] = function(val) { > > properties[i] = val; > > }; > > > This code only defines a function but doesn't execute its contents > > right now, and as functions "capture" the variables defined outside of > > them if you change the value of i then it will "change" in properties > > [i] too. In other words the `i` in properties[i] is the same that you > > use for the loop. > > > If you use a closure you can define a local variable that gets the > > value (not the reference!) of the current index so that won't change > > afterwards. > > > Sounds complicated but it really isn't - once you get it :) > > > On Dec 18, 5:52 pm, "pablo fernandez" > > wrote: > >> That Does it too!! > > >> I still don't get why 'i' keeps always the last value if you don't do > >> var i = j; :S > > >> On Thu, Dec 18, 2008 at 1:11 PM, Balazs Endresz > > >> wrote: > > >> > I've just had a look at it and where this issue comes up in the book > >> > there's a new variable declared (like on page 153). No need to pass > >> > the argument this way, moreover not that easy to mistype: > > >> > for ( var j in properties ) { (function(){ > >> > var i=j; > >> > ... > > >> > I can't believe no one has spotted > >> > this:http://www.apress.com/book/errata/275 > > >> > On Dec 18, 4:53 pm, Pablo Fernandez > >> > wrote: > >> >> That did it, although I had to add this too > > >> >> -- }).call(this,i); > > >> >> in order to pass the parameter > > >> >> Thanks Balazs!!! > > >> >> On 18 dic, 12:29, Balazs Endresz wrote: > > >> >> > Oops, I didn't notice it: you have to pass the `i` variable too: > >> >> > for ( var i in properties ) { (function(i){ > > >> >> > That's why you need the closure at all. Without that you will get the > >> >> > last property from all getters. > > >> >> > The reference of `this` will always change if you put it in an > >> >> > additional function, doesn't matter if it's inside an instantiated > >> >> > object. Well, you can call that either design error or feature too :) > > >> >> > On Dec 18, 4:18 pm, Pablo Fernandez > >> >> > wrote: > > >> >> > > another thing... why inside the anonymous function 'this' refers to > >> >> > > 'window' ?? it's totally misleading... > > >> -- > >> Fernandez, Pablo. > > -- > Fernandez, Pablo.
[jQuery] scrollbar
hi2all how can we have an eye on scrollbar ? I want an event that will run on scrollbar changed ! have i to use "setTimeout" function to findout that scrollbar position has changed?! thanks before
[jQuery] Re: problems with async in IE but not mozilla
How about using Firefox (and more importantly Firebug) from Studio (right click on aspx file, choose "Browse With"), to make sure all libraries are getting loaded On Dec 18, 1:28 pm, paulcurtis wrote: > Hi, > > I really can't work this out. Im testing the async version of > treeview, just retrieving JSON from a static file for the time being. > > I have it set up in visual studio, running on the in built development > server. I have an aspx file and a plain htm file containing the JSON. > (I've deconstructed my real project down to this simple test case) > > I cannot get the treeview to work (retrieve the json) from IE 7 but > the exact same setup works fine in mozilla. > > If i run the set up based on the demo from my local file system within > IE i get a message about active x and scripting and it works fine. > (that's just html files) > > So this is only from visual studio (via built in development server) > and just IE. I assume it's some kind of security settings within IE > but i've tried every combination i can think off. From trusted sites > to lowering all security. > > Has anyone seen anything similar? Or might point me in the right > direction, it's driving me nuts! > > cheers > paul
[jQuery] Re: Fetch (ajax) a file only if it's been modified
I'm making some progress, if I include the following: I get a response header with: Last-Modified 1229624249 If I then wait a bit and make a change to cause test.txt to be updated, I get: Last-Modified 1229627412 So I'm definitely getting the Last-Modified header sent but all the responses still show up as 200. I should be getting 304s until test.txt is updated, then get one 200, then more 304s until test.txt is update again, right? On Dec 18, 11:05 am, Mike Alsup wrote: > > I take it back, my livedata_fetch.php is coming back with a 200 > > status, but I want it coming back with a 304 not modified, right? > > That means it'll only fetch the file if it's been updated since the > > last time it was fetched? > > Right. The server needs to set the Last-Modified header for this to > work correctly. If it does, jQuery will use that date/time in the If- > Modified-Since header. If the resource has not been modified then the > server should return an empty response body with a 304 status.
[jQuery] Re: animate image size
> I saw the demos where div sizes were animated. Can this be done with an > image? I have some button(image) links on my site. I would like to make > each image a little bigger when you hover over it. Anyone know the best way > to do this?Thanks Yes, you can certainly animate images. And you can create some very interesting effects doing so. http://docs.jquery.com/Effects/animate
[jQuery] Re: Fetch (ajax) a file only if it's been modified
> I take it back, my livedata_fetch.php is coming back with a 200 > status, but I want it coming back with a 304 not modified, right? > That means it'll only fetch the file if it's been updated since the > last time it was fetched? Right. The server needs to set the Last-Modified header for this to work correctly. If it does, jQuery will use that date/time in the If- Modified-Since header. If the resource has not been modified then the server should return an empty response body with a 304 status.
[jQuery] Re: (newbie) animate: css-style changes but webpage doesn't
you may first need to specify the positioning of the elements as absolute or relative. The top style property won't effect the element unless the position is first defined. On Dec 18, 1:24 pm, nachocab wrote: > Hi guys, > I was testing out animate using firebug and as an example, I'm able to > move every anchor in thewww.jquery.compage by typing this in the > console: > $("a").animate( { "top": "-=10px"}, "slow" ); > > But if I go to this other page:http://flowplayer.org/tools/scrollable.html > which has jQuery in the header and I type in the same command, I can > see the style in the anchors changing in Firebug, but the page stays > the same: > > Home > Home > Home > > What am I missing? > Thanks, > > Nacho
[jQuery] animate image size
I saw the demos where div sizes were animated. Can this be done with an image? I have some button(image) links on my site. I would like to make each image a little bigger when you hover over it. Anyone know the best way to do this?Thanks Mike
[jQuery] Browser Hangs while hiding 2K+ table rows
I've been converting a legacy web app to use JQuery. I've now cleaned it up so that my HTML validates and I have instrumented the code with classes and id's as appropriate. This app is essentially a table that displays the status of jobs for Autosys. The problem that I'm having is that when I hide the entire list, the browser hangs for several minutes. There are sometimes over 2000 rows. I have cached the full resultset into a variable, though I'm not sure how helpful this is. In the code below, the initial setting of $allRows doesn't take much time at all, but when I hit the hide() line, the browser hangs for wy too long. interestingly, if I comment out the hide() command, and then manually issue a comand like $allRows.css("color", "red"); it works in a very reasonable amount of time. $(function() { $allRows = $("tbody>tr"); $allRows.hide(); } Also, if I let it run once to completion and all of the rows are hidden, then I can show() them and hide() them in reasonable time. Is it something with my selector? Thanks, folks. Eric
[jQuery] Re: JSON support in flash plugin?
Did you ever get anywhere with this? I just stumbled upon a similar requirement. On Dec 8, 5:50 am, mikael wrote: > Hi > > I have aflash(swf) file that needs rather extensive input in form > offlash-vars. Myflashcolleague would like to recieve theflash-vars as > an object (JSON). Have any of you tried that - or maybe even extended > Luke's (great!)plugin? This is how you feedflash-vars to the movie > 'out of the box': > > $('#example').flash( { > src: 'example.swf', > width: 720, > height: 480, > flashvars: { foo: 'bar', baz: 'zoo' } > }, > { version: 8 } > ); > > This is what I need: > > $('#example').flash( { > src: 'example.swf', > width: 720, > height: 480, > flashvars: { > 'my-object': { > 'foo': 'bar', > 'baz': 'zoo' > } > }, > { version: 8 } > );
[jQuery] [treeview] problems with async in IE but not mozilla
Hi, I really can't work this out. Im testing the async version of treeview, just retrieving JSON from a static file for the time being. I have it set up in visual studio, running on the in built development server. I have an aspx file and a plain htm file containing the JSON. (I've deconstructed my real project down to this simple test case) I cannot get the treeview to work (retrieve the json) from IE 7 but the exact same setup works fine in mozilla. If i run the set up based on the demo from my local file system within IE i get a message about active x and scripting and it works fine. (that's just html files) So this is only from visual studio (via built in development server) and just IE. I assume it's some kind of security settings within IE but i've tried every combination i can think off. From trusted sites to lowering all security. Has anyone seen anything similar? Or might point me in the right direction, it's driving me nuts! cheers paul
[jQuery] invalid arg line 1121 in ie6
Hi, Is following psuedo syntax valid in jQuery? It is causing an error in ie6(invalid arg line 1121 in ie6): $(window).bind('load', function() { ... $('#headerNavLeft .special').each(function() { $('li:first', $('ul', $(this))).css('padding-left', (xPos-offset) +'px'); } }
[jQuery] Re: how do i select all anchors OUTSIDE of a specific tag
I'm no jquery expert, but something like this might work $('a').each(function(){ if(this.parent() != $('#x')) { this.click(function(){ //do stuff here }); }); I haven't tested this but it may do the trick
[jQuery] Re: Pro Javascript Techniques Doubt
Yeah it sounds complicated... I'm kinda newbe to this, I hope you don't mind if I ask these silly questions I thought the anonymous function got executed on this line for ( var i in properties ) { (function(){ this[ "get" + i ] = function() { return properties[i]; }; this[ "set" + i ] = function(val) { properties[i] = val; }; }).call(this)--> EXECUTE! (and use actual value of i) // now go on with the next i ; } Isn't this the "logical" way of seeing it? what am I missing? On Thu, Dec 18, 2008 at 3:38 PM, Balazs Endresz wrote: > > this[ "set" + i ] = function(val) { >properties[i] = val; > }; > > This code only defines a function but doesn't execute its contents > right now, and as functions "capture" the variables defined outside of > them if you change the value of i then it will "change" in properties > [i] too. In other words the `i` in properties[i] is the same that you > use for the loop. > > If you use a closure you can define a local variable that gets the > value (not the reference!) of the current index so that won't change > afterwards. > > Sounds complicated but it really isn't - once you get it :) > > On Dec 18, 5:52 pm, "pablo fernandez" > wrote: >> That Does it too!! >> >> I still don't get why 'i' keeps always the last value if you don't do >> var i = j; :S >> >> On Thu, Dec 18, 2008 at 1:11 PM, Balazs Endresz >> >> >> >> wrote: >> >> > I've just had a look at it and where this issue comes up in the book >> > there's a new variable declared (like on page 153). No need to pass >> > the argument this way, moreover not that easy to mistype: >> >> > for ( var j in properties ) { (function(){ >> >var i=j; >> >... >> >> > I can't believe no one has spotted >> > this:http://www.apress.com/book/errata/275 >> >> > On Dec 18, 4:53 pm, Pablo Fernandez >> > wrote: >> >> That did it, although I had to add this too >> >> >> -- }).call(this,i); >> >> >> in order to pass the parameter >> >> >> Thanks Balazs!!! >> >> >> On 18 dic, 12:29, Balazs Endresz wrote: >> >> >> > Oops, I didn't notice it: you have to pass the `i` variable too: >> >> > for ( var i in properties ) { (function(i){ >> >> >> > That's why you need the closure at all. Without that you will get the >> >> > last property from all getters. >> >> >> > The reference of `this` will always change if you put it in an >> >> > additional function, doesn't matter if it's inside an instantiated >> >> > object. Well, you can call that either design error or feature too :) >> >> >> > On Dec 18, 4:18 pm, Pablo Fernandez >> >> > wrote: >> >> >> > > another thing... why inside the anonymous function 'this' refers to >> >> > > 'window' ?? it's totally misleading... >> >> -- >> Fernandez, Pablo. > > > -- Fernandez, Pablo.
[jQuery] Re: Pro Javascript Techniques Doubt
this[ "set" + i ] = function(val) { properties[i] = val; }; This code only defines a function but doesn't execute its contents right now, and as functions "capture" the variables defined outside of them if you change the value of i then it will "change" in properties [i] too. In other words the `i` in properties[i] is the same that you use for the loop. If you use a closure you can define a local variable that gets the value (not the reference!) of the current index so that won't change afterwards. Sounds complicated but it really isn't - once you get it :) On Dec 18, 5:52 pm, "pablo fernandez" wrote: > That Does it too!! > > I still don't get why 'i' keeps always the last value if you don't do > var i = j; :S > > On Thu, Dec 18, 2008 at 1:11 PM, Balazs Endresz > > > > wrote: > > > I've just had a look at it and where this issue comes up in the book > > there's a new variable declared (like on page 153). No need to pass > > the argument this way, moreover not that easy to mistype: > > > for ( var j in properties ) { (function(){ > > var i=j; > > ... > > > I can't believe no one has spotted > > this:http://www.apress.com/book/errata/275 > > > On Dec 18, 4:53 pm, Pablo Fernandez > > wrote: > >> That did it, although I had to add this too > > >> -- }).call(this,i); > > >> in order to pass the parameter > > >> Thanks Balazs!!! > > >> On 18 dic, 12:29, Balazs Endresz wrote: > > >> > Oops, I didn't notice it: you have to pass the `i` variable too: > >> > for ( var i in properties ) { (function(i){ > > >> > That's why you need the closure at all. Without that you will get the > >> > last property from all getters. > > >> > The reference of `this` will always change if you put it in an > >> > additional function, doesn't matter if it's inside an instantiated > >> > object. Well, you can call that either design error or feature too :) > > >> > On Dec 18, 4:18 pm, Pablo Fernandez > >> > wrote: > > >> > > another thing... why inside the anonymous function 'this' refers to > >> > > 'window' ?? it's totally misleading... > > -- > Fernandez, Pablo.
[jQuery] Re: syntax for $(response).$('a').each()
$ is a global object that calls find(), not a method of jQuery objects. Use the find() method directly: $(response).find('a').each(function(i){... - ricardo On Dec 18, 3:25 pm, Namotco wrote: > $('#divid').load(url, function( response ){ > $(response).$('a').each(function(i){ > // do stuff > }); > }); > > Unfortunately, that doesn't work, what's the correct syntax for that?
[jQuery] Re: html() triggering twice?
Try binding the handler to the .change() event in the select instead. On Dec 18, 1:51 pm, Ray Myers wrote: > I'm working on this interface where there are three select elements. > When an option in the first menu is clicked this code executes > > == > > $('.state_select OPTION').livequery('click', function() { > var el = $(this).parent(); > if ( $(el).val() != 'all' ) { > $.post('includes/tools.php', { get_counties: $(el).val(), catgry: $ > (el).parents('.target_form').find('#category').val() }, function(data) > { > if ( data == "" ) { > alert('No results.'); > } else { > alert(data); > > $(el).parents('.target_form').find('#county').html(data).removeAttr > ('disabled'); > } > }); //End POST > } // End if > return false; > > }); //End .state_select OPTION CHANGE > > = > > This does what it's supposed to, generate and load a set of options to > add to the next select element and enable it. The problem is it's > adding the list twice. > > I added the alert for testing and it only shows the code once. I have > no idea whats happening here. > > Thanks > - Ray
[jQuery] Re: html() triggering twice?
I fixed it, never mind. Ray On Dec 18, 10:51 am, Ray Myers wrote: > I'm working on this interface where there are three select elements. > When an option in the first menu is clicked this code executes > > == > > $('.state_select OPTION').livequery('click', function() { > var el = $(this).parent(); > if ( $(el).val() != 'all' ) { > $.post('includes/tools.php', { get_counties: $(el).val(), catgry: $ > (el).parents('.target_form').find('#category').val() }, function(data) > { > if ( data == "" ) { > alert('No results.'); > } else { > alert(data); > > $(el).parents('.target_form').find('#county').html(data).removeAttr > ('disabled'); > } > }); //End POST > } // End if > return false; > > }); //End .state_select OPTION CHANGE > > = > > This does what it's supposed to, generate and load a set of options to > add to the next select element and enable it. The problem is it's > adding the list twice. > > I added the alert for testing and it only shows the code once. I have > no idea whats happening here. > > Thanks > - Ray
[jQuery] Re: how do i select all anchors OUTSIDE of a specific tag
In $('body').not('#x') you are asking for all 'body' tags which don't have the 'x' ID. That gives you zero elements. The second example is closer, but .not() doesn't support complex selectors. $('a').filter(function(){ return !$(this).parents('#x').length; }); docs.jquery.com/Traversing/filter - ricardo On Dec 18, 1:11 pm, elubin wrote: > How do i select all of the anchor links that are NOT in the div x? > > > outide div 1 > > inside div 1 a> > inside div 2 > inside div 3 > > outide div 2 > outide div 3 > > > // this doesn't work > $('body').not('#x').find('a').click(... > // this doesn't work > $('a').not('#x a').click(...
[jQuery] Re: Simple way to track dragging?
Anyone? I mean i have the code for the mouse up/down working and it repositions the element on mouse up(and this is only about 400 bytes of code) but i can get it to resize as the mouse moves. It seems like i would not have to have 24K on minjs code just to havet he ability to resize an element on a mousedown+mousemove but if so i will use the jquery UI draggable code. Eridius wrote: > > I know i can do mouseup/mousedown to track where the mouse was clicked > down and where the mouse was clicked up but it there a simple way to track > the dragging from those 2 point without inlcude 25K mined js from jquery > ui(which is 9X+ the size of my current plugin). > -- View this message in context: http://www.nabble.com/Simple-way-to-track-dragging--tp21072641s27240p21078290.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] (newbie) animate: css-style changes but webpage doesn't
Hi guys, I was testing out animate using firebug and as an example, I'm able to move every anchor in the www.jquery.com page by typing this in the console: $("a").animate( { "top": "-=10px"}, "slow" ); But if I go to this other page: http://flowplayer.org/tools/scrollable.html which has jQuery in the header and I type in the same command, I can see the style in the anchors changing in Firebug, but the page stays the same: Home Home Home What am I missing? Thanks, Nacho
[jQuery] Re: Fetch (ajax) a file only if it's been modified
I take it back, my livedata_fetch.php is coming back with a 200 status, but I want it coming back with a 304 not modified, right? That means it'll only fetch the file if it's been updated since the last time it was fetched?
[jQuery] Re: Event listener optimisation advice
Yes, there is. There is a technique called event delegation which consists of exactly that. the Delegate plugin does it: http://www.danwebb.net/2008/2/8/event-delegation-made-easy-in-jquery as does LiveQuery in its own way: http://brandonaaron.net/docs/livequery/ google 'event delegation' and you should get boatloads of information. - ricardo On Dec 18, 1:12 pm, fambi wrote: > Hi All, > > Is there some kind of performance cost in setting up lots of event > listeners? > > For example, rather than setting up lots of click event listeners, > would it be better to set up a single one which then uses if/else to > decide how to process it? Obviously, it might not always be practical, > but I'm just after the theory side of things right now. > > Thanks. > > F.
[jQuery] Re: Fetch (ajax) a file only if it's been modified
For the Last-Modified header, do I need to do something like this in my file that gets fetched every X seconds (livedata_fetch.php in my case): header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); On Dec 18, 9:57 am, Magnificent wrote: > Does not look to have a Last-Modified header and I'm not seeing the > xhr.status code (but I'm obviously getting something in the 200 range > back as I'm receiving the data?) This comes via Firebug: > > Response Headers > Date Thu, 18 Dec 2008 17:48:49 GMT > Server Apache/2.0.52 (CentOS) > X-Powered-By PHP/4.3.9 > Vary Accept-Encoding,User-Agent > Content-Encoding gzip > Content-Length 448 > Keep-Alive timeout=15, max=43 > Connection Keep-Alive > Content-Type text/html > > Request Headers > User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) > Gecko/2008102920 Firefox/3.0.4 > Accept */* > Accept-Language en-us,en;q=0.5 > Accept-Encoding gzip,deflate > Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 > Keep-Alive 300 > Connection keep-alive > If-Modified-Since Thu, 01 Jan 1970 00:00:00 GMT > X-Requested-With XMLHttpRequest > > On Dec 18, 2:42 am, Mike Alsup wrote: > > > > $.ajax({ > > > url: "livedata_fetch.php", > > > ifModified: true, > > > success: function(data){ > > > $("div#livedata").html(data); > > > } > > > }); > > > That's the correct way to do it. Does that page have a Last-Modified > > header? Does the server return a 304 on subsequent requests?
[jQuery] Re: Fetch (ajax) a file only if it's been modified
Does not look to have a Last-Modified header and I'm not seeing the xhr.status code (but I'm obviously getting something in the 200 range back as I'm receiving the data?) This comes via Firebug: Response Headers DateThu, 18 Dec 2008 17:48:49 GMT Server Apache/2.0.52 (CentOS) X-Powered-ByPHP/4.3.9 VaryAccept-Encoding,User-Agent Content-Encodinggzip Content-Length 448 Keep-Alive timeout=15, max=43 Connection Keep-Alive Content-Typetext/html Request Headers User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 Accept */* Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive If-Modified-Since Thu, 01 Jan 1970 00:00:00 GMT X-Requested-WithXMLHttpRequest On Dec 18, 2:42 am, Mike Alsup wrote: > > $.ajax({ > > url: "livedata_fetch.php", > > ifModified: true, > > success: function(data){ > > $("div#livedata").html(data); > > } > > }); > > That's the correct way to do it. Does that page have a Last-Modified > header? Does the server return a 304 on subsequent requests?
[jQuery] Re: Anyone Else Seeing This?
Thanks for trying this for me... I have two users that are having problems and have given me detailed specs - and one did a fairly extensive test for me: All experience the slow 45-60sec render: G4 Tower unit / OS X 10.2.8 / Safari 1.0.3 (v85.8.1) / Mozilla 5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.19) Gecko 20081203 Firefox 2.0.0.19 plus a G4 laptop running the same browsers but OS X 10.3 G5 MacPro Tower unit / OS X 10.5.5 / Safari 3.2.1 / Firefox 3.0.5 plus a G5 MacBook Pro running all of the above for the tower G5. The other user is: Mac OS 10.5.5 Firefox 3.0.5 (Default Browser) Safari 3.1.2 Both are on the same cable ISP - however so are a whole host of PC & several Ubuntu users not experiencing the issue. This may turn out to be very off topic - I have no idea - just throwing it out there for anyone who might have some idea what it may be. (sweeps more hair off the floor...)
[jQuery] Re: syntax for $(response).$('a').each()
Here is what I'm trying to do: $("#MTB").load(url +" #content", function(data) { $("a", data).attr("onclick",function (arr) { var href=this.attr('href'); if (href.match('string') ) {return "getMTB (this.href); return false;"; } else { return 'alert(this.href); return false;' ;} }); }); It doesn't seem to work though
[jQuery] Re: [validate] [metadata]
Could you provide a complete example, eg. a testpage? See also http://docs.jquery.com/Discussion#Support_Questions Jörn On Thu, Dec 18, 2008 at 6:37 PM, SeanthePaddy wrote: > > hi there, > > i have a quick question about the validation plugin - i have a big > form working perfectly except for a select that will for some reason > not show the error message: > > can anyone spot anything wrong below please : > > > tnx > sean > > > === > > > > > >Country: > > > > > title="asdsasasdsadasadasdassadaasds" class="none {rules: > {required:true}}">Please select country option>Afghanistan > > * > > >
[jQuery] syntax for $(response).$('a').each()
$('#divid').load(url, function( response ){ $(response).$('a').each(function(i){ // do stuff }); }); Unfortunately, that doesn't work, what's the correct syntax for that?
[jQuery] [validate] [metadata]
hi there, i have a quick question about the validation plugin - i have a big form working perfectly except for a select that will for some reason not show the error message: can anyone spot anything wrong below please : tnx sean === Country: Please select countryAfghanistan *
[jQuery] Re: Font size in sifr plugin
Did you get yours to work? I have not. Looks like it could be a really great plugin but I think I am going to do this the old fashion way...images. I can't wait any longer. On Dec 17, 8:24 am, A Wood wrote: > I am having the same problem. Got the sIfr to work but can't get the > font size right. > > On Dec 15, 5:43 pm, flycast wrote: > > > Yes. I have also copied the examples at the bottom of this > > page:http://jquery.thewikies.com/sifr/#description > > > And they work except that the resulting swf ends up being very small. > > The text in the "Sample text" example starts out being 5em but the swf > > that replaces it ends up being about 12px. > > > I can get it working but the size is messed up. > > > On Dec 15, 10:36 am, banalitis wrote: > > > > Have you given line-height alongside font-size a go? > > > > On 15 Dec, 16:25, flycast wrote: > > > > > I am trying to get the sifr plugin working. It seems to be working > > > > except that I cannot get the size of the font to change except by > > > > using zoom. I have the Gunmetal swf file specified and the font is > > > > changing to the Gunmetal font. > > > > > I have tried setting the height using style in the tag and using a > > > > class in a seperate css file. Both times I disables the sifr plugin to > > > > make sure that the styles were "taking". > > > > > If I use zoom then the text gets cut off. > > > > > What is the proper way to control font size?
[jQuery] stop by mouseover and run by mouseout
hi, i have a function who displayed alternate content from 3 DIVs with a fadeIn Now i want to try, that the display rotation stoped if my mousepointer goes in the DIV but i doesnt work. whats my misstake? http://www.w3.org/1999/xhtml";> http://code.jquery.com/jquery-latest.js";> function fadeEngine(x) { var total_divs=3; var y=x; if ( !over ) { if(x==total_divs) y=1; else y++; $("#fade"+x).css("display","none"); $("#fade"+y).fadeIn("slow"); $("#container").hover( function() { over = this.id; }, function() { over = false; }); } setTimeout('fadeEngine('+y+')',3000); } fadeEngine(0); Content one Content two Content three
[jQuery] Re: Make list of unique json data?
On Thu, Dec 18, 2008 at 4:49 AM, alpha tester wrote: > > > Hmmm... struggling to read from this new dataset using the code provided - > can someone point out the stupidity in the following code: > > > > > var myData = > { records : [ > { CATEGORY : "Sport", TITLE : "The world of sport", LINK: "http://test.com"; > }, > { CATEGORY : "Sport", TITLE : "More sport", LINK: "http://test.com"; }, > { CATEGORY : "News", TITLE : "News views", LINK: "http://test.com"; }, > { CATEGORY : "News", TITLE : "Some more news", LINK: "http://test.com"; }, > { CATEGORY : "Events", TITLE : "Big Events", LINK: "http://test.com"; }, > { CATEGORY : "Events", TITLE : "Small Events", LINK: "http://test.com"; }, > ]}; > > > > > > > test > > > >
[jQuery] Re: Dynamic form validation on different names possible?
You could generate the rules object. var rules = {}; $(":input[name*=date-start"]).each(function() { rules[this.name] = { ... } }); $("...").validate({options:rules}); Jörn On Thu, Dec 18, 2008 at 3:01 PM, dfiguero wrote: > > Hi, > > I'm trying to validate a form with a dynamic date fields. Something > like: > > > > value="Mar. 29, 2008" /> > > > > > > value="Jun. 02, 2010" /> > > > > ... > > > value="aaa. 99, " /> > > > > > I got my validation rules working but only if I hardcode each of the > input's names: > > $("form").validate({ > rules: { >"date-1-start": compare ["#date_1-start","#date_1-end"], >"date-2-start": compare ["#date_2-start","#date_2-end"], >... >"date-n-start": compare ["#date_n-start","#date_n-end"] > } > }); > > Would there be a way to dynamically generate the rules? Something > like: > > $("form").validate({ > rules: { >$(":input[name*=date-start"]): compare [$(":input[name*=date- > start"]),$(":input[name*=date-end"])], > } > }); > > I know I could perhaps do this by adding classes to the input fields > but I would prefer avoiding that option. > > Thanks > >
[jQuery] Re: element:gt(0) works in FF, but not in Safari/IE/Chrome
Yes, I'm using Firebug on Firefox, but the Problem only shows up in Safari / IE. Here is an example page: http://dev.rocho.org/nico-jquery You can click on the menu (Arbeiten, Vita, Kontakt) and the menu will expand. It should work in FF, but not in Safari / IE - why? It also works in Safari/IE when I use jQuery 1.2.3, but not with jQuery 1.2.5 and later. Jan On 18 Dez., 17:27, Ricardo Tomasi wrote: > Try this: > > function menu_loader() > { > var speed = 200; > $("#menu ul").each(function(i){ > var $that = $('#menu ul:eq('+i+') > *:gt(0)'); > /* v1 - hide items if not active */ > $that.not('.active').hide(); > > $(this).attr('id', 'c' + i) > .children(":first").css({ cursor: 'pointer' }).end() > .click(function(){ > $('#c" + i + " li:gt(0)').toggle(speed); > $('#content').hide(); > }); > }); > }; > > 1. Are you using Firebug for debugging? > 2. Are you sure that selector returns an empty object? > 3. Could you post a test page? :) > > - ricardo > > On Dec 18, 11:50 am, "Jan Rocho" wrote: > > > I have done some additional testing and I think this might be a jQuery > > bug which was introduced at v1.2.5. jQuery v1.2.4 was not released and > > the script works in all browsers up to jQuery 1.2.3. But one of my > > other scripts only works in jQuery 1.2.6, so I need that version. > > > On Thu, Dec 18, 2008 at 2:01 PM, DasJan wrote: > > > Hi! > > > > I have the following code which, using jQuery 1.1.2 works in FF/Safari/ > > > IE: > > > > function menu_loader() > > > { > > > var speed = 200; > > > var item_title = new Array(); > > > var items = new Array(); > > > var i = 0; > > > $("#menu ul").each(function() > > > { > > > items[i] = $("#menu ul").eq(i).children().filter(function > > > (index) { return index > 0; }); > > > /* v1 - hide items if not active */ > > > if (items[i].is(".active") == false) { items[i].hide(); } > > > /* v2 - hide all */ > > > //items[i].hide(); > > > //apply the clicker > > > $(this).attr('id', 'c' + i); > > > $(this).children(":first").css({ cursor: 'pointer' }); > > > $(this).attr('onclick', "$('ul#c" + i + " li:gt(0)').toggle(" > > > + speed + ");$('#content').hide();"); > > > i++; > > > }); > > > } > > > > I just recently updated to jQuery 1.2.6 and the above code now only > > > works in FF, but not in Safari/IE/Chrome. > > > > I have a menu which is based on unordered lists, the first is the > > > title of the menu which is always supposed to be displayed, the other > > > are only to be displayed when I click on the first IE. When I try this > > > in Safari/IE/Chrome and click on the visible LI, nothing happens. > > > > I also tried replacing the line with: > > > > $(this).attr('onclick', "$('ul#c" + i + " li:not(:first-child)').toggle > > > (" + speed + ");$('#content').hide();"); > > > > and > > > > $(this).attr('onclick', "$('ul#c" + i + " li').slice(1).toggle(" + > > > speed + ");$('#content').hide();"); > > > > Both of those also work in FF, but again not in Safari/IE/Chrome. > > > > Any ideas? > > > > Thanks, > > > Jan
[jQuery] html() triggering twice?
I'm working on this interface where there are three select elements. When an option in the first menu is clicked this code executes == $('.state_select OPTION').livequery('click', function() { var el = $(this).parent(); if ( $(el).val() != 'all' ) { $.post('includes/tools.php', { get_counties: $(el).val(), catgry: $ (el).parents('.target_form').find('#category').val() }, function(data) { if ( data == "" ) { alert('No results.'); } else { alert(data); $(el).parents('.target_form').find('#county').html(data).removeAttr ('disabled'); } }); //End POST } // End if return false; }); //End .state_select OPTION CHANGE = This does what it's supposed to, generate and load a set of options to add to the next select element and enable it. The problem is it's adding the list twice. I added the alert for testing and it only shows the code once. I have no idea whats happening here. Thanks - Ray
[jQuery] stop function by mouseOver
Hello, i m real desperate about this. with my function i displayed the content of my 3 DIV elements in a interval. it works fine. since a long time im trying to prog a feature wich make a displayStop by a mouseover. i need this to listen the long content in a div. after i moved out of the div the function should be run again. but how? here is my code: http://www.w3.org/1999/xhtml";> http://code.jquery.com/jquery-latest.js";> function fadeEngine(x) { var total_divs=3; var y=x; if(x==total_divs) {y=1;} else {y++; } $("#fade"+x).css("display","none"); $("#fade"+y).fadeIn("slow"); setTimeout('fadeEngine('+y+')',3000); } fadeEngine(0); Content one Content two Content three can someone help me please i dont know how to fineshed the code in jQ thanks a lot
[jQuery] IE8.
Our friends at Microsoft have a lot of work to do until their new born browser IE8 (Still in Beta 2) actually works the way it should. It seems that there is a major event triggering issue. Lots of jQuery core functionalities depends of events. For the ones interested to see some upcoming bugs, download IE8 beta 2 and visit the following links. Jquery Corner. (Not working) http://www.malsup.com/jquery/corner/
[jQuery] Re: What am I doing wrong here -- htmlTo?
What you want in full jQuery is: $("#foo").empty().append(''); which is the exact equivalent of $("#foo").html(''); // html() does call this.empty().append() It is very different from the browser innerHtml since your HTML will first be parsed by jQuery into a DOM tree while innerHtml just insert your raw source. One side effect of innerHtml is that the browser may trigger quirk rendering if you use it. Because the browser does not ensure your HTML is actually valid, some browsers (like Firefox in XHTML mode) just switch back to quirk mode if you use innerHtml. (document.write() has the same kind of issues.) Always using jQuery to parse your HTML into a DOM tree will allow you to keep your document in standard rendering. Have fun with jQuery On Dec 18, 4:41 am, ken wrote: > You're right, somehow I missed it. Thanks everyone! > > On Wed, Dec 17, 2008 at 9:22 PM, Ricardo Tomasi wrote: > > > > > What's wrong with the solution suggested by Kean above? It's prettier > > than this and works fine. > > > $('#foo').html('').find('img').attr > > ("src","asdf.gif"); > > > - ricardo > > > On Dec 17, 6:03 pm, ken wrote: > > > That's basically the form I've developed thus far: > > > > var img = jQuery( '' ).attr( 'src', 'image.gif' ); > > > jQuery( '#foo' ).html( img ).prepend( '' ).append( > > '' > > > ); > > > > It just seems very inelegant contrasted with the 'normal' jQuery usage. > > > > On Wed, Dec 17, 2008 at 11:41 AM, Hector Virgen > > wrote: > > > > Or you could do this: > > > > > var img = << your image element wrapped in s >> > > > > $('#foo').html(img); > > > > > -Hector > > > > > On Wed, Dec 17, 2008 at 9:36 AM, brian wrote: > > > > >> On Wed, Dec 17, 2008 at 11:13 AM, ken wrote: > > > >> > I need to replace the contents of #foo. > > > > >> > I would love to use CSS, and if I were starting anew that would be > > the > > > >> case, > > > >> > but unfortunately I am working on an existing application converting > > the > > > >> > plain-jane JS to jQuery. I'm simply trying to replace existing > > > >> functionality > > > >> > WITHOUT affecting the HTML because the HTML is very fragile (the > > > >> existing JS > > > >> > utilizes DOM walking exclusively, so removing/replacing nodes causes > > a > > > >> > cascade of fail). > > > > >> ok, then, how about just using a string instead of setting the > > attributes > > > >> later? > > > > >> $('#foo').html('');
[jQuery] Dynamic form validation on different names possible?
Hi, I'm trying to validate a form with a dynamic date fields. Something like: ... I got my validation rules working but only if I hardcode each of the input's names: $("form").validate({ rules: { "date-1-start": compare ["#date_1-start","#date_1-end"], "date-2-start": compare ["#date_2-start","#date_2-end"], ... "date-n-start": compare ["#date_n-start","#date_n-end"] } }); Would there be a way to dynamically generate the rules? Something like: $("form").validate({ rules: { $(":input[name*=date-start"]): compare [$(":input[name*=date- start"]),$(":input[name*=date-end"])], } }); I know I could perhaps do this by adding classes to the input fields but I would prefer avoiding that option. Thanks
[jQuery] Suckerfish not dropping down and everything is floated to the right
Hi I'm using suckerfish on my site at http://www.sthig.com/unisource and all works well except in IE6. I can't seem to get the menus to drop down. here is my css: http://www.sthig.com/unisource/style.css Also, everything is floated to the right thus breaking the site in IE6. Any fix to this? you can see a shot of it breaking here: http://www.sthig.com/unisource/1.jpg http://www.sthig.com/unisource/2.jpg I know I'm new...but I'm desperate and reaching out all over the web for help. I've got a looming deadline and I need to get this done. I've tried everything to get suckerfish and the float to stop but nothing is working. Please help? Thanks!
[jQuery] Event listener optimisation advice
Hi All, Is there some kind of performance cost in setting up lots of event listeners? For example, rather than setting up lots of click event listeners, would it be better to set up a single one which then uses if/else to decide how to process it? Obviously, it might not always be practical, but I'm just after the theory side of things right now. Thanks. F.
[jQuery] IE8.
Our friends at Microsoft have a lot of work to do until their new born browser IE8 (Still in Beta 2) actually works the way it should. It seems that there is a major event triggering issue. Lots of jQuery core functionalities depends of events. For the ones interested to see some upcoming bugs, download IE8 beta 2 and visit the following links. Jquery Corner. (Not working) http://www.malsup.com/jquery/corner/
[jQuery] how do i select all anchors OUTSIDE of a specific tag
How do i select all of the anchor links that are NOT in the div x? outide div 1 inside div 1 inside div 2 inside div 3 outide div 2 outide div 3 // this doesn't work $('body').not('#x').find('a').click(... // this doesn't work $('a').not('#x a').click(...
[jQuery] suckerfish not working and my site is floating to the right
Hi I'm using suckerfish on my site at http://www.sthig.com/unisource and all works well except in IE6. I can't seem to get the menus to drop down. here is my css: http://www.sthig.com/unisource/style.css Also, everything is floated to the right thus breaking the site in IE6. Any fix to this? you can see a shot of it breaking here: http://www.sthig.com/unisource/1.jpg http://www.sthig.com/unisource/2.jpg I know I'm new...but I'm desperate and reaching out all over the web for help. I've got a looming deadline and I need to get this done. I've tried everything to get suckerfish and the float to stop but nothing is working. Please help? Thanks!