[jQuery] Re: tablesorter line numbers
Is there any way to get the following code to refresh after every sort? The $(#myTable).each(function(){numbers it, and if I replace it with $(#myTable).bind(sortEnd,function(){ it just adds a new numbered row after every sort (three sorts gets you three columns of numbers). -- $(document).ready(function(){ $(#myTable).each(function(){ if($(this).is('table')){ $('thead th:first-child, thead td:first-child', this).each (function(){ if($(this).is('td')) $(this).before('td#/td'); else if($(this).is('th')) $(this).before('thItem/th'); }); $('tbody td:first-child', this).each(function(i){ $(this).before('td'+(i+1)+'/td'); }); } });
[jQuery] Re: mouseover highlighting rows using tablesorter plug-in
Hey, I've got my table set up. The rows all work backwards and forwards, and I've got the columns disabled that I want disabled. But I have searched and tested and I can't find any method of mouseover highlighting that works. For some reason, addClass and removeClass don't seem to work. I know just enough to know that I've exhausted my meager knowledge. (p.s. is it possible to add a column that is exempt from sorting? something like the number column to the far left in an excel document?) This is the code I'm working with: jquery $(document).ready(function() { $.tablesorter.defaults.widgets = ['zebra']; $(#myTable).tablesorter({headers: {5: {sorter: false}, 6: {sorter: false}, 7: {sorter: false}, 8: {sorter: false}, 9: {sorter: false}, 10: {sorter: false}, 11: {sorter: false} } }); $(.tablesorter tr).mouseover(function(){ $(this).addClass(over);}); $(.tablesorter tr).mouseout(function(){ $(this).removeClass(over);}); }); -- css .over { background-color: #fff880; } table#myTable tbody tr.odd { background-color: #edf3ff; } table#myTable tbody tr.even { background-color: #ff; } html table id=header tr td~ 2010 VBS Review ~/td /tr /table table id=myTable class=tablesorter thead tr style=cursor:default thTitle/th thPublisher/th thMajor Theme/th thMinor Theme/th thSetting/th thDaily Points/th thDaily Verses/th thDaily Stories/th thCharacters/th thSongs/th thCrafts/th thGames/th thPrice/th /tr tr tdtitle/td tdpublisher/td tdmajor theme/td tdminor theme/td tdsetting/td tddaily points/td tddaily verses/td tddailystories/td tdcharacters/td tdsongs/td tdcrafts/td tdgames/td tdprices/td /tr /body
[jQuery] Re: image refresh problem due to browser cache
That I already tried, but it did not work. AJAX was able to continuously send the request, but the resulted images did not get displayed. On Nov 13, 1:42 am, Matthew mvbo...@gmail.com wrote: you could try appending some sort of query string on the end of the image name? http://images.earthcam.com/ec_metros/newyork/newyork/lindys.jpg?refre...[random_number]; for [random_number] try generating a random number using javascript then putting it there. I have heard that passing a query string can trick browsers into thinking it is a different file. On Nov 12, 6:02 pm, Jay jinqi...@gmail.com wrote: I am trying to display a image on my website. The image always has the same file name, but the content will change each time it is requested. I use the following code to refresh it on my web site, but it only works with Firefox. Is there any better way to do it? html head titleSimple Page/title meta http-equiv=Content-Type content=text/html; charset=utf-8 meta http-equiv=Expires content=-1 meta http-equiv=Pragma content=no-cache meta http-equiv=Cache-Control content=no-store, no-cache, must-revalidate, max-age=0 script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/ jquery.min.js type=text/javascript/script script type=text/javascript function refreshimage( ) { $(#imgNYC).attr(src, http://images.earthcam.com/ ec_metros/newyork/newyork/lindys.jpg); $(#imgNYC).show(); setTimeout(refreshimage, 500); } $(document).ready(function(){ $(window).load(refreshimage()); }); /script /head body table tr tdimg src=http://images.earthcam.com/ec_metros/newyork/ newyork/lindys.jpg alt= id=imgNYC /td /tr /table /body /html
[jQuery] image refresh problem due to browser cache
I am trying to display a image on my website. The image always has the same file name, but the content will change each time it is requested. I use the following code to refresh it on my web site, but it only works with Firefox. Is there any better way to do it? html head titleSimple Page/title meta http-equiv=Content-Type content=text/html; charset=utf-8 meta http-equiv=Expires content=-1 meta http-equiv=Pragma content=no-cache meta http-equiv=Cache-Control content=no-store, no-cache, must-revalidate, max-age=0 script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/ jquery.min.js type=text/javascript/script script type=text/javascript function refreshimage( ) { $(#imgNYC).attr(src, http://images.earthcam.com/ ec_metros/newyork/newyork/lindys.jpg); $(#imgNYC).show(); setTimeout(refreshimage, 500); } $(document).ready(function(){ $(window).load(refreshimage()); }); /script /head body table tr tdimg src=http://images.earthcam.com/ec_metros/newyork/ newyork/lindys.jpg alt= id=imgNYC /td /tr /table /body /html
[jQuery] Overriding default checkbox behavior
Hello, I'm working on an application wherein I have a checkbox that triggers an ajax call to update a database. Should the database operation fail, I want the checkbox to retain its old state. I'm having trouble making this work. The closest I've gotten is that if I bind the 'click' event of the checkbox and call event.preventDefault() in the handler, the box changes state then reverts once the handler exits. I'm testing using an alert() in the handler rather than the actual ajax call. If I bind to the change event instead, the box changes and stays changed, despite the preventDefault call. Perhaps also relevant is that getting the box's state (via $(#mycheckbox).attr('checked')) within the handler gives the new state. Any ideas on how to get complete control over whether the box gets checked or not, or even just insight into what's going on here in terms of the event model. I am new to jquery and javascript in general, so I'm bringing a lot of ignorance to the table. Thanks in advance.
[jQuery] Superfish not embedding
This site: [url]http://www.prodigytech.com[/url] I'm having problems with embedding the Superfish vertical menu. anything found underneath it actually extends to under the superfish menu. couldn't find where in the css it might help. thanks!
[jQuery] How to simulate a human-triggered event?
Hi, I'm trying to change the value of an input field (target) which depends on another input (source). It works well when I manually change the source value. But if I changed the source value with another button, the target value remains the same. Here's the code... $(document).ready(function() { $('input#change').click(function() { $('input#source').attr('value', 'This is the value changed by a button'); }); $('input#source').change(function() { $('input#target').attr('value', $('input#source').attr('value')); }); }); pSource: input type=text name=target id=source size=60 value= / input type=button id=change value=change source value //p pTarget: input type=text name=target id=target size=60 value=This is the original value, type something in source to change //p So how could the target input detect if there's a change within the source input without manually changing it's value? Thanks
[jQuery] Re: replacing entire html node having jquery trigger document.ready again for new content
Is the document not ready after innerHTML is set? I'd imagine there would be circumstances where different browsers would behave differently with styling of certain DOM elements, but I imagine you could special case those situations. On Apr 12, 10:31 am, e.sand elisand@gmail.com wrote: So far I've been able to get this piece of code to do almost all of what I want - only problem is that the browser is able to track this in it's cache, so back/forward buttons iterate through each new document.write() call: var html = data.responseText.match(/html?[\s\S]+\/html/im); document.open(); document.write(html); document.close(); Doing it this way actually triggers the document.ready event so everything runs just fine (except the caching issue). I've tried doing: document.documentElement.innerHTML = html; instead of the open/write/close calls, but it doesn't trigger the document.ready event (if I recall), and also it causes some odd css formatting problems (css attached to the html node seems to not get applied or something).
[jQuery] Re: .each - how to write in my code?
inside the each you need to reference this or $(this) instead of referencing all of the elements again. On Apr 12, 11:38 am, adesign andersek...@gmail.com wrote: Hello, I am very new to jQuery and don´t know how to write my code for every item. Here is my code for a list with hover functions, I would like for every item to be processed separately. I know about a functio that is written .each, but can´t seem to get it to work. --- script type=text/javascript $(function() { // set opacity to nill on page load $(ul#menu span).css(opacity,0); $(ul#menu li).each(function () { // on mouse over $(ul#menu a).hover(function () { // animate opacity to full $('ul#menu span').stop().animate({ opacity: 1 }, 'slow'); }, // on mouse out function () { // animate opacity to nill $('ul#menu span').stop().animate({ opacity: 0 }, 'slow'); }); }); }); /script --- hope someone has some answers or a book to recommend for a newbie. Regards /adesign
[jQuery] Live events within plugin question
I'm working on a multiselect plugin that uses only live events, and the way it works is the select element gets replaced by an input and div element. I would like to supply a callback function where the callback is tied to the input element. Is using the data method to store the callback the best way to proceed? Also, how should I handle the removal of the select element. Like this? $.fn.myPlugin = function(options,callback) { this.each(function() { }).remove(); } or do I need to do this: mySelect.myPlugin().remove(); Thanks
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
Just curious.. What is the difference between mouseover.dc and mouseover? On Apr 10, 1:44 pm, Ricardo ricardob...@gmail.com wrote: This (untested) is how I envision the code for that: $.fn.dragCheck = function(){ //this == the current jQuery element return this.each(function(){ //this == current element in the loop (table etc) $(this).bind('mousedown', function(e){ //don't do anything if you didn't click a checkbox if ( !$(e.target).is(':checkbox') ) return true; //get the clicked checkbox state isChecked = e.target.checked; //apply it to all other checkboxes on mouseover $boxes.bind('mouseover.dc', function(){ this.checked = isChecked; }); }).bind('mouseup', function(e){ //cancel the mouseover action $boxes.unbind('mouseover.dc'); }); }; $('#table1').dragCheck(); cheers, - ricardo On 9 abr, 17:15, Lwangaman donjohn.f...@gmail.com wrote: Ok I resolved the cannot assign to a function result problem by putting the value assignment into a function(){}: 48 $(td.mychkbox).each( 49 function(){ 50 $(this).bind( 51 mouseover, 52 function(){ 53 if (gCheckedValue != null){ 54 var eccomi = this; 55 var eccoti = $(eccomi).find(input:checkbox); 56* function(){$(eccoti).attr(checked) = gCheckedValue;} 57 } 58 }); 59 }); Now I don't get any errors, but the event assignments don't seem to be working together correctly... Basically what's supposed to happen is this: 1 - onclick event of the checkboxes is canceled since the clicking and dragging is being assigned to the table cells that contain them 2 - the table cells themselves don't actually have on onclick event, because the value is given to the checkboxes with the onmousedown and especially the onmouseover event. 3 - onmousedown gives the variable gCheckedValue a value, either of true or of false (depending on the actual state of the checkbox, so if it is unchecked it will get checked and vice-versa), and onmouseup empties gCheckedValue of any value. So as long as the mouse is down, gCheckedValue has a value to give to any of the checkboxes with the onmouseover event, but as soon as the mouse button is released it no longer has a value so the onmouseover event will no longer effect any of the checkboxes until the mousebutton is pressed again. So the value of gCheckedValue is set in the mousedown event, and is transmitted in the mouseover event. And yet the code doesn't seem to be working correctly. The current value of the cell is detected correctly (I've gotten it through an alert), it's contrary is correctly set in gCheckedValue (I've gotten that through an alert too), but the new value is not being set in the checkbox... In fact click sets no value, click and hold sets no value, click and drag (mouseover the other checkboxes / cells) set no value... On 9 Apr, 14:23, Lwangaman donjohn.f...@gmail.com wrote: I thought I'd undertake the endeavour of translating into jquery the neat little click-n-drag checkboxes functionality of cross- browser.com's X-library. This functionality allows for multiple checkbox selection or de-selection by simply clicking on one of them and then dragging the mouse over the others. I began mentioning this in another post, but I figured that perhaps a new post with the right title would be better. Rather than re-post all the code though, here's a reference to the message where the full code of both the X-library functions and my attempted translation of them is posted: http://groups.google.com/group/jquery-en/msg/0f38d747d97cf701 I doesn't quite seem to work though, none of my checkboxes are getting selected either on click or on drag. Any javascript - jquery experts have any ideas on what needs to be perfected? When I run it in Internet Explorer, the debugger gives me this message: Cannnot assign to a function result and it refers to line 56, which should be the one that sets the selection: 48 $(td.mychkbox).each( 49 function(){ 50 $(this).bind( 51 mouseover, 52 function(){ 53 if (gCheckedValue != null){ 54 var eccomi = this; 55 var eccoti = $(eccomi).find(input:checkbox); 56* $(eccoti).attr(checked) = gCheckedValue; 57 } 58 }); 59 });- Hide quoted text - - Show quoted text -
[jQuery] Re: how to avoid load jquery several times?
You can check the version with $().jquery. You can remove all instances of jquery from the current page using something like this: if(jQuery) $('script[src^=jquery]').remove(); There is also the noConflict method which might help. On Apr 10, 1:44 pm, ihomest...@gmail.com ihomest...@gmail.com wrote: Hi, Is there a way to avoid loading jquery multiple times? I have some javascript code which needs to use jquery and at the same time. This script is embeded in others' web site. One way I could do is to check and then decide whether to load jquery: if (typeof jQuery != 'undefined') { // do something } If jQuery is defined then I know for sure that it is loaded. But the loaded version might be the same one my javascript needs. Is there a good way to solve this problem? Does jQuery allows the use of namespace? For example, even though jquery is loaded by other scripts but could I load a new jQuery again into a separate namespace without breaking the loaded jQuery version? If this is allowed, I could just always load the right jquery into my own namespace and use all the functions my javascript needs. Any ideas? Thanks.
[jQuery] Re: Error with BlockUI: 'parentNode' is null or not an object
Why not just surround it in: if (node){ ..code that uses a non-null node } On Apr 10, 3:59 am, mikemad madd...@gmail.com wrote: I'm getting the error 'parentNode' is null or not an object when using BlockUI (Latest version and latest Jquery). I'm also using Microsoft AJAX.NET. I'm blocking on an element. The problem occurs on the second time I call block. This is the line of code: $(.grid).block({message:$(#prg)}); The error occurs in the 'install' function right here: var node = msg.jquery ? msg[0] : msg; var data = {}; $(el).data('blockUI.history', data); data.el = node; data.parent = node.parentNode; --- ERROR OCCURS HERE It seems that the 'node' variable is NULL. This happens because 'msg.jquery' reports true, however, there are no objects in the 'msg'. Any ideas on this, I'm pulling my thin hair out. I make sure that I unblock before I call block again. Please help I'm behind schedule. Mike
[jQuery] Re: jquery treeview menu problem
Can you post an example? I'm not sure I understand your question. On Apr 10, 5:23 am, Titti prima...@gmail.com wrote: Hi, i'm using jquery treeview (http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ ) menu in my website and i have a little problem: when i open a page from the menu tree, menu expands completely and items alignes to the left side for a while, the time that page is charghing. I don't know why, can u help me? thank you
[jQuery] Re: jcarousel and text below image
If you want it directly below the image the easiest thing to do would be to position it absolutely to this position when you hover over the image. Something like this might work: div = $(div style='display:none'blah/div) jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); $(document.body).appendChild(div); }, function(){ div.css({display:'none'}); }); Since the image elements are sort of dynamic it might be better to use live events with mouseover/mouseout, or mousemove On Apr 10, 9:54 am, globalpropertyonline@gmail.com globalpropertyonline@gmail.com wrote: Hi, I am playing with jcarousel and trying to show text below my images. Like for example the reference nr or name of the image. I am showing images of properties from my database and allow the user to scroll through the properties. If they like one, they can click on it and it will then show a page with more details on it. I have tried to add text but it seems to show only one character that I can see because it is behine the next image. I have then tried to use the BR tagg but this does not move the text down. Here is my code and would you be so kind to try and help me or point me in the right direction. I am not sure if you can add the text here or If I have to add it in the jquery.jcarousel.js You can see the test URL here and would apreciate any help or advice. http://www.somewhere2rent.com/test/ I am not sure what to change in the stylesheet, have tried to make some options bigger or smaller but do not realy know. Below is code that I have tried to add text to. return 'a href=' + url_m + ' title=' + item.title + ' myrefval=' + item.myref + ' mydescval=' + item.mydesc + ' myCountryURLval=' + item.myCountryURL + ' myCountryval=' + item.myCountry + ' myRegionval=' + item.myRegion + ' myTownval=' + item.myTown + ' myTermval=' + item.myTerm + ' myAreaval=' + item.myArea + ' myagentcodeval=' + item.myagentcode + 'img src=' + item.url + ' width=175 height=125 border=0 alt=' + item.title + ' /My text here ???/a'; return 'a href=' + url_m + ' title=' + item.title + ' myrefval=' + item.myref + ' mydescval=' + item.mydesc + ' myCountryURLval=' + item.myCountryURL + ' myCountryval=' + item.myCountry + ' myRegionval=' + item.myRegion + ' myTownval=' + item.myTown + ' myTermval=' + item.myTerm + ' myAreaval=' + item.myArea + ' myagentcodeval=' + item.myagentcode + 'img src=' + item.url + ' width=175 height=125 border=0 alt=' + item.title + ' /BRMy text here ???/a'; script type=text/javascript function mycarousel_itemLoadCallback(carousel, state) { for (var i = carousel.first; i = carousel.last; i++) { if (carousel.has(i)) { continue; } if (i mycarousel_itemList.length) { break; } // Create an object from HTML var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList[i-1])).get (0); // Apply thickbox tb_init(item); carousel.add(i, item); } }; /** * Item html creation helper. */ function mycarousel_getItemHTML(item) { var url_m = item.url.replace(/_s.jpg/g, '_m.jpg'); return 'a href=' + url_m + ' title=' + item.title + ' myrefval=' + item.myref + ' mydescval=' + item.mydesc + ' myCountryURLval=' + item.myCountryURL + ' myCountryval=' + item.myCountry + ' myRegionval=' + item.myRegion + ' myTownval=' + item.myTown + ' myTermval=' + item.myTerm + ' myAreaval=' + item.myArea + ' myagentcodeval=' + item.myagentcode + 'img src=' + item.url + ' width=175 height=125 border=0 alt=' + item.title + ' //a'; }; jQuery(document).ready(function() { jQuery('#mycarousel').jcarousel({ size: mycarousel_itemList.length, itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback} }); }); /script .jcarousel-skin-ie7 .jcarousel-container { -moz-border-radius: 10px; background: #D4D0C8; border: 2px solid #808080; } .jcarousel-skin-ie7 .jcarousel-container-horizontal { width: 545px; padding: 20px 40px; } .jcarousel-skin-ie7 .jcarousel-container-vertical { width: 200px; height: 545px; padding: 40px 20px; } .jcarousel-skin-ie7 .jcarousel-clip-horizontal { width: 545px; height: 130px; } .jcarousel-skin-ie7 .jcarousel-clip-vertical { width: 180px; height: 130px; } .jcarousel-skin-ie7 .jcarousel-item { width: 175px; height: 125px; border: 1px solid #fff; } .jcarousel-skin-ie7 .jcarousel-item:hover { border-color: #808080; } .jcarousel-skin-ie7 .jcarousel-item-horizontal { margin-right: 7px; } .jcarousel-skin-ie7 .jcarousel-item-vertical { margin-bottom: 7px; } .jcarousel-skin-ie7 .jcarousel-item-placeholder { } /** * Horizontal Buttons */ .jcarousel-skin-ie7 .jcarousel-next-horizontal { position: absolute; top: 65px; right: 5px; width: 32px; height: 32px; cursor: pointer; background: transparent url(next-horizontal.gif) no-repeat 0 0; }
[jQuery] Re: jcarousel and text below image
You can put it at the very bottom and wrap it with script tags, or you could put it in the head in script tags like this: head script $(function(){ ..onload code goes here.. }); /script /head Also $(document.body).appendChild(div); can go after the div is declared instead. I would suggest you perhaps read some books/ tutorials on javascript and/or jquery to learn more. It is very different from ASP since ASP is server-side code and javascript is client-side. On Apr 10, 4:01 pm, globalpropertyonline@gmail.com globalpropertyonline@gmail.com wrote: Me again I tried your code here like this. but it does not seem to work. Any pointers ??? script type=text/javascript function mycarousel_itemLoadCallback(carousel, state) { for (var i = carousel.first; i = carousel.last; i++) { if (carousel.has(i)) { continue; } if (i mycarousel_itemList.length) { break; } // Create an object from HTML var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList [i-1])).get(0); // Apply thickbox tb_init(item); carousel.add(i, item); } }; /** * Item html creation helper. */ function mycarousel_getItemHTML(item) { var url_m = item.url.replace(/_s.jpg/g, '_m.jpg'); return 'a href=' + url_m + ' title=' + item.title + ' myrefval=' + item.myref + ' mydescval=' + item.mydesc + ' myCountryURLval=' + item.myCountryURL + ' myCountryval=' + item.myCountry + ' myRegionval=' + item.myRegion + ' myTownval=' + item.myTown + ' myTermval=' + item.myTerm + ' myAreaval=' + item.myArea + ' myagentcodeval=' + item.myagentcode + 'img src=' + item.url + ' width=175 height=125 border=0 alt=' + item.title + ' //a'; div = $(div style='display:none'blah/div) }; jQuery(document).ready(function() { jQuery('#mycarousel').jcarousel({ size: mycarousel_itemList.length, itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback} }); }); jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); $(document.body).appendChild(div); }, function(){ div.css({display:'none'}); }); /script On Apr 10, 8:50 pm, globalpropertyonline@gmail.com globalpropertyonline@gmail.com wrote: Thank you for taking the time to respond to my question I am not vary good at Javascript and I am learning as I am going along. I do most of my stuff with ASP. Could you be so kind to tell me where I would place this code in the code that I supplied ? I managed to get this working by changing things and refresh. Takes me a long time, but I learn If you could tell me where to PLACE THIS CODE AND SEE IT IN ACTION, i CAN THEN TRY TO SEE WHAT TO DO AND HOW TO CHANGE IT... div = $(div style='display:none'blah/div) jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); $(document.body).appendChild(div); }, function(){ div.css({display:'none'}); }); OR IF YOU CAN, show me how to implement this bit, I will so greatfull. Since theimageelements are sort of dynamic it might be better to use live events with mouseover/mouseout, or mousemove Thnak you again for your time. Hugo On Apr 10, 8:22 pm, jay jay.ab...@gmail.com wrote: If you want it directlybelowtheimagethe easiest thing to do would be to position it absolutely to this position when you hover over theimage. Something like this might work: div = $(div style='display:none'blah/div) jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); $(document.body).appendChild(div);}, function(){ div.css({display:'none'}); }); Since theimageelements are sort of dynamic it might be better to use live events with mouseover/mouseout, or mousemove On Apr 10, 9:54 am, globalpropertyonline@gmail.com globalpropertyonline@gmail.com wrote: Hi, I am playing withjcarouseland trying to showtextbelowmy images. Like for example the reference nr or name of theimage. I am showing images of properties from my database and allow the user to scroll through the properties. If they like one, they can click on it and it will then show a page with more details on it. I have tried to addtextbut it seems to show only one character that I can see because it is behine the nextimage. I have then tried to use the BR tagg but this does not move thetextdown. Here is my code and would you be so kind to try and help me or point me in the right direction. I am not sure if you can add thetexthere or If I have to add it in the jquery.jcarousel.js
[jQuery] Re: Endeavour: translating X-Library functionality click-n-drag checkboxes into Jquery
So if you have multiple mouseover events binded to the same DOM element you may selectively unbind them? On Apr 10, 7:26 pm, Jonathan jdd...@gmail.com wrote: 'mouseover.dc' is just a namespaced event. It allows you to unbind only that specific mouseover later by calling $boxes.unbind ('mouseover.dc'). It's a useful way of keeping track of events. On Apr 10, 4:17 pm, Lwangaman donjohn.f...@gmail.com wrote: Ok first of all thanks for taking interest! Then, I've tried going through your code and applying it, and I have a few questions: -- Besides the mouseover.dc that I didn't get either... -- I'm supposing that $boxes would be a variable where all the checkboxes that are applicable have been stored previously? Yet, if you build it as a plugin you have no way of defining which checkboxes are to comprised (unless this functionality is built into the plugin using data passed through parameters, I suppose). -- Then I don't quite understand what the mousedown is being bound to. In my example (which was not built as a plugin, but I suppose a plugin or defined function would be even better because it's much more flexible and anyone can download it and use it), the mousedown was being bound to all the cells that had checkboxes in them, and I was determining that through the class I had given them mychkbox (because I didn't want some of the checkboxes included, since they do not have an active state; the table has names, addresses, emails, and those that don't have an email have an inactive checkbox). I was also trying to follow cross-browser.com's way of listening to the mousedown on the cell containing the checkbox rather than on the checkbox itself, making the whole click-drag thing a lot more user-friendly. On 10 Apr, 20:36, jay jay.ab...@gmail.com wrote: Just curious.. What is the difference between mouseover.dc and mouseover? On Apr 10, 1:44 pm, Ricardo ricardob...@gmail.com wrote: This (untested) is how I envision the code for that: $.fn.dragCheck = function(){ //this == the current jQuery element return this.each(function(){ //this == current element in the loop (table etc) $(this).bind('mousedown', function(e){ //don't do anything if you didn't click a checkbox if ( !$(e.target).is(':checkbox') ) return true; //get the clicked checkbox state isChecked = e.target.checked; //apply it to all other checkboxes on mouseover $boxes.bind('mouseover.dc', function(){ this.checked = isChecked; }); }).bind('mouseup', function(e){ //cancel the mouseover action $boxes.unbind('mouseover.dc'); }); }; $('#table1').dragCheck(); cheers, - ricardo On 9 abr, 17:15, Lwangaman donjohn.f...@gmail.com wrote: Ok I resolved the cannot assign to a function result problem by putting the value assignment into a function(){}: 48 $(td.mychkbox).each( 49 function(){ 50 $(this).bind( 51 mouseover, 52 function(){ 53 if (gCheckedValue != null){ 54 var eccomi = this; 55 var eccoti = $(eccomi).find(input:checkbox); 56* function(){$(eccoti).attr(checked) = gCheckedValue;} 57 } 58 }); 59 }); Now I don't get any errors, but the event assignments don't seem to be working together correctly... Basically what's supposed to happen is this: 1 - onclick event of the checkboxes is canceled since the clicking and dragging is being assigned to the table cells that contain them 2 - the table cells themselves don't actually have on onclick event, because the value is given to the checkboxes with the onmousedown and especially the onmouseover event. 3 - onmousedown gives the variable gCheckedValue a value, either of true or of false (depending on the actual state of the checkbox, so if it is unchecked it will get checked and vice-versa), and onmouseup empties gCheckedValue of any value. So as long as the mouse is down, gCheckedValue has a value to give to any of the checkboxes with the onmouseover event, but as soon as the mouse button is released it no longer has a value so the onmouseover event will no longer effect any of the checkboxes until the mousebutton is pressed again. So the value of gCheckedValue is set in the mousedown event, and is transmitted in the mouseover event. And yet the code doesn't seem to be working correctly. The current value of the cell is detected correctly (I've gotten it through an alert), it's contrary is correctly set in gCheckedValue (I've gotten that through an alert too), but the new value is not being set in the checkbox... In fact click sets no value, click
[jQuery] Re: How do get the ID of an element that has been clicked ?
$('div').click(function(){ alert(this.id); }); On Apr 10, 8:46 pm, thought thou...@orcon.net.nz wrote: Hi all. This might be more of a javascript problem rather than a jquery problem, but I'm also wondering if there is a 'jquery way' of solving it. Given this code: DIV id=div_one/DIV DIV id=div_two/DIV DIV id=div_three/DIV DIV id=div_four/DIV Lets say that the user is invited to click one one of these divs. How do I get the id of the div that was clicked ? Thanks.
[jQuery] Re: How do get the ID of an element that has been clicked ?
A live handler is different from a normal handler, and I'm not sure why you're putting a normal handler inside of a live handler. A live handler works by looking at the target of whatever is clicked and comparing it to the selector, in this case, the thumbnail class. I personally prefer to use live handlers for content that is added and removed dynamically since it is easier to manage. On Apr 10, 9:30 pm, thought thou...@orcon.net.nz wrote: Thanks for the swift replies. I've got a lot to learn about javascript, and at this point, adapting charlies code, I get a strange effect that I didn't anticipate, and don't understand. $('.thumbnail').live(click, function(){ $(div[id^='thumbnail']).click(function() { alert( $(this).attr('id') ); }); For the first time I click on a div, I get nothing. No alert. For the second time I click a div, the alert pops up a couple of times. For the third time, the div pops up multiple times - displaying the id, and then displaying the name of the class. I'm guessing that I'm encountering something about js that I don't understand. If someone were to give me a pointer that explains this behaviour, and how to change it I'd be grateful. Thanks.
[jQuery] Re: Dragable Limit
It would be fairly trivial to roll your own drag-drop plugin, and this way you can have better control of the characteristics. For general info on how drag-drop works in javascript (in the event that you don't already know) I have found this web page invaluable (it is the first link that pops up when you google javascript drag drop): http://www.webreference.com/programming/javascript/mk/column2/ Also here is plugin authoring: http://docs.jquery.com/Plugins/Authoring On Apr 10, 3:05 pm, thertze...@gmail.com thertze...@gmail.com wrote: Is there a way to limit the number of divs that can be placed inside my droppable div? I haven't found it on the docs. I'm sure its simple, I just cannot find an answer. Thanks!
[jQuery] Orphan nodes
Is there a general rule of thumb to avoid orphan nodes? I'm using a multiselect plugin which I'd like to be able to remove from the DOM but it is creating orphan nodes in IE and the nodes are not removed according to sIEve. I suspect it is the order that the elements are removed from the DOM, but I'm not sure. Here is the example I'm working from: html head script src='jquery.js'/script script src=jqueryMultiSelect.js/script link href=jqueryMultiSelect.css rel=stylesheet type=text/css / script function Add(){ $('#selectBin').html('select id=control_1 name=control_1[] multiple=multiple size=5'+ 'option value=/optionoption value=option_1Option 1/option'+ 'option value=option_2Option 2/option'+ 'option value=option_3Option 3/option'+ 'option value=option_4Option 4/option'+ 'option value=option_5Option 5/option'+ '/select'); $('#selectBin').find('select').multiSelect(); } function Remove(){ $('#selectBin').empty(); } /script /head body button onclick='Add()'Add Select/button button onclick='Remove()'Remove Select/button table tr td id='selectBin' /td /tr /table /body /html
[jQuery] Re: Orphan nodes
I made a more general test case, and I'm finding it is necessary for me to unbind events within a given plugin in order for it to go away in IE7. I thought empty and remove were supposed to unbind stuff for me? Here is my test case: html head script src='jquery.js'/script script src=jqueryMultiSelect.js/script link href=jqueryMultiSelect.css rel=stylesheet type=text/css / script (function($){ $.fn.myPlugin = function(options) { var defaults = { option1: 1, option2: 2 }; var options = $.extend(defaults, options); return this.each(function() { $(this).click(function(){alert('clicked')}); }); }; })(jQuery); function Add(){ $('#selectBin')[0].innerHTML = 'select id=control_1 name=control_1[] multiple=multiple size=5 '+ 'option value=/optionoption value=option_1Option 1/option'+ 'option value=option_2Option 2/option'+ 'option value=option_3Option 3/option'+ 'option value=option_4Option 4/option'+ 'option value=option_5Option 5/option'+ '/select'; //$('#selectBin').find('select').multiSelect(); $('#selectBin').find('select').myPlugin(); } function Remove(){ $('#selectBin').find('select').unbind('click') $('#selectBin').empty(); } function AddRemove(x){ for(var i=0;ix;i++){ Add(); Remove(); } } /script /head body button onclick='Add()'Add Select/button button onclick='Remove()'Remove Select/button button onclick='AddRemove(1000)'Add/Remove 1000 times/button table tr td id='selectBin' /td /tr /table /body /html On Apr 9, 3:16 pm, jay jay.ab...@gmail.com wrote: Is there a general rule of thumb to avoid orphan nodes? I'm using a multiselect plugin which I'd like to be able to remove from the DOM but it is creating orphan nodes in IE and the nodes are not removed according to sIEve. I suspect it is the order that the elements are removed from the DOM, but I'm not sure. Here is the example I'm working from: html head script src='jquery.js'/script script src=jqueryMultiSelect.js/script link href=jqueryMultiSelect.css rel=stylesheet type=text/css / script function Add(){ $('#selectBin').html('select id=control_1 name=control_1[] multiple=multiple size=5'+ 'option value=/optionoption value=option_1Option 1/option'+ 'option value=option_2Option 2/option'+ 'option value=option_3Option 3/option'+ 'option value=option_4Option 4/option'+ 'option value=option_5Option 5/option'+ '/select'); $('#selectBin').find('select').multiSelect();} function Remove(){ $('#selectBin').empty();} /script /head body button onclick='Add()'Add Select/button button onclick='Remove()'Remove Select/button table tr td id='selectBin' /td /tr /table /body /html
[jQuery] Re: IE7 memory leak solution
I've added similiar functionality to the remove and empty methods to fix this bug. I know dojo does something similiar. Also I've noticed that it still causes leaks if the content you load has script in it. For example: div onclick=alert(1)/div On Mar 9, 4:33 pm, mif86 finsta...@gmail.com wrote: Hi. Update on the IE7 memoryleakproblem Original problem: I'm having problems with all ajax updates, $(#element).load() etc., as well as just setting html content with html(). Doing this over and over will gradually eat up IE 7's memory. Test case to reproduce:http://mif86.com/memtest3.htm It periodically loads another page's html content (http://mif86.com/ memtest2.htm) into a div using jQuery's $(#element).load (memtest2.htm). If you watch the memory usage in internet explorer, it keeps growing endlessly. Solution: But doing this before updating element content prevents the memoryleakcompletely, it seems: document.getElementById('test').innerHTML = ''; Should this perhaps be patched to the jQuery remove() method somehow, so that it will notleak? Ref.:http://www.outofhanwell.com/ieleak/index.php?title=Fixing_Leaks
[jQuery] Re: iframe ang jQuery
It doesn't matter what is used to generate the (x)html/css. Just set the src of the iframe to the URL and it should work. On Mar 27, 3:47 pm, themba themba.ntl...@gmail.com wrote: Hi Guys is it possible to embed a php website on an asp website using jQuey or is possible to create a dynamic height iframe for embedding another website running a different technology? Thank you.
[jQuery] Re: Array of all checked checkboxes
Simple example: body script src=jquery.js/script input class=cbx id=cbx1 type=checkbox / input class=cbx id=cbx2 type=checkbox checked=true / input class=cbx id=cbx3 type=checkbox checked=true / input class=cbx id=cbx4 type=checkbox / input class=cbx id=cbx5 type=checkbox / script var checked = $('.cbx:checked'); alert(checked[0].id+, +checked[1].id) /script /body On Mar 27, 3:55 pm, Thierry lamthie...@gmail.com wrote: I have a series of checkboxes with class=the_checkbox. I can get all checkboxes by classname and manually loop through each to find out the checked ones. I'm wondering if I can get an array of checkboxes that have been checked with one line of jQuery?
[jQuery] How to drag link from another window and using the javascript in the main window to intercept the link and add customized handler?
How to drag link from another window and using the javascript in the main window to intercept the link and add customized handler? The goal is to have an event handler in the main window, then whenever a new link from different browser window is dragged into the main window, the dropped link will be handled by the main window's handler instead of the default browser behavior --- load the linked page in the main window. Any suggestion on how to achieve this in a browser compatible way? Thanks.
[jQuery] How to use superfish menu style
Dear All, Please help me in installing and using superfish menu in my website. I downloaded the file but I don't know how to make it work in my website for the menus. Thanks in advance Jay
[jQuery] Access DOM cross-domain
I'm playing around with writing a server-side script that generates JSONP from content that is downloaded by the script (URL is passed to script from querystring). Is there a better way to do it than to encode it as base64, or is there a work-around that doesn't require any server-side code? I'm basically trying to get access to a given page's DOM cross-domain using minimal server-side code. I suppose one thing that would be needed here is a regex to replace non http src attributes. Here is what I have so far: //test.htm body div id=mydiv/div script src=jquery.js/script script src=jquery.base64.js/script script function callback(e){ alert(e.data); alert($.base64Decode(e.data)); $(#mydiv).html($.base64Decode(e.data)); } /script script src=test.aspx?url=www.wikipedia.org/script /body //test.aspx %@ Page Language=C# AutoEventWireup=true % %@ Import Namespace=System % %@ Import Namespace=System.IO % %@ Import Namespace=System.Net % %@ Import Namespace=System.Text % script runat=server void Page_Load( object sender, EventArgs e ){ string url = Request[url] ?? ; Response.Write(callback({data:\+EncodeTo64(Get(url))+\})); Response.End(); } string EncodeTo64(string toEncode){ byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes (toEncode); string returnValue = System.Convert.ToBase64String (toEncodeAsBytes); return returnValue; } string Get(string strURL){ WebRequest myWebRequest = WebRequest.Create(http://+strURL); WebResponse myWebResponse = myWebRequest.GetResponse(); Stream ReceiveStream = myWebResponse.GetResponseStream(); Encoding encode = System.Text.Encoding.GetEncoding(utf-8); StreamReader readStream = new StreamReader( ReceiveStream, encode ); return readStream.ReadToEnd(); } /script
[jQuery] Re: Access DOM cross-domain
That would work, and would probably be less CPU and bandwidth intensive. I was concerned about special characters initially, and wanted to make a proof of concept. Does what I'm doing make any sense to do though? Am I correct in that a read-only version of the DOM is unavailable otherwise? On Feb 9, 4:29 pm, Ricardo Tomasi ricardob...@gmail.com wrote: Why not simply use escaped plain text? On Feb 9, 6:04 pm, jay jay.ab...@gmail.com wrote: I'm playing around with writing a server-side script that generates JSONP from content that is downloaded by the script (URL is passed to script from querystring). Is there a better way to do it than to encode it as base64, or is there a work-around that doesn't require any server-side code? I'm basically trying to get access to a given page's DOM cross-domain using minimal server-side code. I suppose one thing that would be needed here is a regex to replace non http src attributes. Here is what I have so far: //test.htm body div id=mydiv/div script src=jquery.js/script script src=jquery.base64.js/script script function callback(e){ alert(e.data); alert($.base64Decode(e.data)); $(#mydiv).html($.base64Decode(e.data));} /script script src=test.aspx?url=www.wikipedia.org/script /body //test.aspx %@ Page Language=C# AutoEventWireup=true % %@ Import Namespace=System % %@ Import Namespace=System.IO % %@ Import Namespace=System.Net % %@ Import Namespace=System.Text % script runat=server void Page_Load( object sender, EventArgs e ){ string url = Request[url] ?? ; Response.Write(callback({data:\+EncodeTo64(Get(url))+\})); Response.End();} string EncodeTo64(string toEncode){ byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes (toEncode); string returnValue = System.Convert.ToBase64String (toEncodeAsBytes); return returnValue;} string Get(string strURL){ WebRequest myWebRequest = WebRequest.Create(http://+strURL); WebResponse myWebResponse = myWebRequest.GetResponse(); Stream ReceiveStream = myWebResponse.GetResponseStream(); Encoding encode = System.Text.Encoding.GetEncoding(utf-8); StreamReader readStream = new StreamReader( ReceiveStream, encode ); return readStream.ReadToEnd();} /script
[jQuery] Re: Cross domain Ajax without Proxy
I tested it and it works cross-domain with IE7 and FF3. It appears to send the data URL encoded inside the CSS like so: #cr0 { background: red url(http://cssrpc/%3Ch1%3EResult%20from%20CSS %201%3C/h1%3E); } #cr1 { background: blue url(http://cssrpc/%3Cp%3EThis%20is%20lorem%20ipsum %20in%20a%20paragraph%20tag.%20Or%20something.%3C/p%3E); } So the url field is then URL decoded and written to the page. Is this right? Is there a advantage of using CSS files instead of JS files for cross-domain data communication? On Dec 12 2008, 12:31 am, Bil Corry b...@corry.biz wrote: ricardobeat wrote on 12/11/2008 7:06 PM: Hi Bill, it seems that that technique doesn't work for FF3, so it's out, unfortunately. It makes reference to an original prototype that does work with FF3, you can see it work here: http://ydnar.typepad.com/css-rpc/css-rpc.html Although it doesn't actually demonstrate loading anythingcross-domain, so I'm not sure if that would work or not. - Bil
[jQuery] Re: Performance suggestion: Use object hash instead of regexp
I imagine a switch is the same speed as a hash (switches generally evaluate to a hash). Using a trie structure could be faster than regex in some circumstances I imagine: http://en.wikipedia.org/wiki/Trie On Feb 3, 12:45 pm, Eric Garside gars...@gmail.com wrote: In that case, wouldn't a switch statement have even less overhead than creating an object to check everytime? I'd think switch(tag){case 'body':case 'html': /* ... */ break;} would be an even faster solution, no? On Feb 3, 12:39 pm, George Adamson george.adam...@softwareunity.com wrote: Absolutely, it is very very limited. So this technique is only suited to the type of regex's that I quoted, like the one used internally by jquery to test for body or html tags only, or to test for t(able|d|h) only. Particulalry when used inside a loop. For parsing a selector we still need regex. On Feb 3, 3:16 pm, Eric Garside gars...@gmail.com wrote: Using a hash I can see for some situations, but unless you can figure out a way (and I'd be super interested if you could) to do complex cascade parsing without regex, your method seems like double the work of rewriting with no benefits towards maintainability and a minor speed increase for only certain tags.- Hide quoted text - - Show quoted text -
[jQuery] feedback for alert replacement plugin
I wrote a quick plugin to replace alert (I didn't like that I couldn't copy and paste from the alert window, and that it was modal). I decided to use window.open instead of absolute divs to show it. I've also used toJSON plugin for when an object is passed in. Faced a couple of problems with getting outerWidth of the browser in IE, and using scrollWidth/scrollHeight to determine window size, which I'm unsure I solved right. feedback? body script src=jquery.js/script script src=json.js/script script (function($){ $.alert = function(obj,options) { var defaults = { maxWidth: 800, maxHeight: 1000 }; var options = $.extend(defaults, options); w = window.open('','','width=100,height=100,resizable=1'); if(typeof obj == object){ obj = \n$.toJSON(+obj+):\n + $.toJSON(obj); } w.document.write(body topmargin=0 leftmargin=0 style='padding: 0px;height:100%'textarea id='ta1' wrap='off' style='background- color:#c0c0c0;color:black;font:8pt lucida console;width:100%;height: 100%'+obj+/textarea/body); var innerWidth = w.innerWidth || w.document.documentElement.clientWidth || w.document.body.clientWidth; var innerHeight = w.innerHeight || w.document.documentElement.clientHeight || w.document.body.clientHeight; var outerWidth = w.outerWidth+12 || innerWidth+32; var outerHeight = w.outerHeight+12 || innerHeight+51; var ta = $('#ta1',w.document) var scrollX = ta[0].scrollWidth+(outerWidth-innerWidth); var scrollY = ta[0].scrollHeight+(outerHeight-innerHeight); w.resizeTo((scrollXoptions.maxWidth)?options.maxWidth:scrollX, (scrollYoptions.maxHeight)?options.maxHeight:scrollY); return this; //if returning something else use return this.pushStack (somethingElse) so that .end() returns this }; })(jQuery); $.alert(jQuery.data); var obj = {one:1,two:2,three:3,four:function(){test=1}}; $.alert(obj); /script /body
[jQuery] Re: Is .parent() only one level up?
I think the method you are looking for is closest On Jan 28, 12:39 pm, kgosser kgos...@gmail.com wrote: Hello, pretty noob question here. I have this example: div form div labelExample/label input type=text/ /div /form /div Now let's say there's this jQuery: $(input).click(function(){ $(this).parent(form).css(color,#F00); }); My question: Does the parent() method work like that, or do I need to do something like $(this).prev().prev() to get to the form? I guess I'm trying to better understand how flexible the parent() and children () methods are. Thanks in advance.
[jQuery] Re: Is .parent() only one level up?
http://docs.jquery.com/Traversing/closest On Jan 28, 12:39 pm, kgosser kgos...@gmail.com wrote: Hello, pretty noob question here. I have this example: div form div labelExample/label input type=text/ /div /form /div Now let's say there's this jQuery: $(input).click(function(){ $(this).parent(form).css(color,#F00); }); My question: Does the parent() method work like that, or do I need to do something like $(this).prev().prev() to get to the form? I guess I'm trying to better understand how flexible the parent() and children () methods are. Thanks in advance.
[jQuery] Re: $('#list').unbind().html('') -- redundant?
html('') calls empty() so starting with 1.2.2 it will also remove all event handlers and internally cached data. On Jan 28, 11:48 am, René renefourn...@gmail.com wrote: I have a dynamically generated a long list of items with events bound to them. I was wondering, when I clear the list, or replace it, is it necessary to unbind all their events before clearing its parent container? I know I can experiment to answer this question, but I wanted to know if perhaps html('') on the parent container runs unbind() anyways? ...Rene
[jQuery] Re: How to wait for load() to finish executing
This could be accomplished using a synchronous xmlhttp call (does jQuery even support this?), or you could put a while loop before the return true to poll a variable that is set in the callback. You would probably want to set the variable if there is an error as well so that the browser doesn't freeze too long. On Jan 28, 10:33 am, Adam apcau...@gmail.com wrote: How can I wait for the load() function to finish before executing the next line of code? The code that I need to execute after load() is finished cannot be called within the callback function. I basically need to return true after the load has finished but not beforehand. Here's the relevant code: jQuery(this).cluetip({ cluetipClass: 'jtip', arrows: true, dropShadow: false, hoverIntent: false, sticky: true, mouseOutClose: false, closePosition: 'title', closeText: 'close', activation: 'click', local: true, hideLocal: true, onActivate: function() { var url = jQuery(this).attr(href); jQuery(this).load(url); //dont' return true until load() is finished return true; } });
[jQuery] Re: Is .parent() only one level up?
parent is just one level. closest() looks up the tree like .parent ().parent()... until a match is found.. I'm not sure if there is an equivalent that would do what you want.. you could try .closest (.parentClass).find(.childClass) On Jan 28, 12:53 pm, kgosser kgos...@gmail.com wrote: No, not necessarily, but thanks for the link. I'll take a deeper look at that. What my question centers around is when I put parent(example); ... how far up the tree does jQuery look for the example -- just one level, or higher? The key is I'm trying to understand how to stop having to write traversing like this: $(this).parent.().parent().prev().prev().prev().children(p.example); If you see what I'm getting at? On Jan 28, 11:42 am, jay jay.ab...@gmail.com wrote: http://docs.jquery.com/Traversing/closest On Jan 28, 12:39 pm, kgosser kgos...@gmail.com wrote: Hello, pretty noob question here. I have this example: div form div labelExample/label input type=text/ /div /form /div Now let's say there's this jQuery: $(input).click(function(){ $(this).parent(form).css(color,#F00); }); My question: Does the parent() method work like that, or do I need to do something like $(this).prev().prev() to get to the form? I guess I'm trying to better understand how flexible the parent() and children () methods are. Thanks in advance.- Hide quoted text - - Show quoted text -
[jQuery] Re: Can jQuery calculate CSS Width/Height
with 1.3.1 I'm able to get pixel measurement from percent with no problem. example: body script src=jquery.js/script div id=d1 style=width:100%;border:1px solid black div id=d2 style=width:90%;border:1px solid black div id=d3 style=width:90%;border:1px solid black div id=d4 style=width:90%;border:1px solid black test /div /div /div /div script alert($(#d1).width()); alert($(#d2).width()); alert($(#d3).width()); alert($(#d4).width()); /script /body On Jan 28, 12:17 pm, Kevin Dalman kevin.dal...@gmail.com wrote: Thanks Matt, but that does not work. As my example shows, the element may have a percentage width, or it could be 'auto' (which it would be if not specifically set). What I need is the 'pixel' measurement that would replicate its current size. In other words, if it currently is width:90%; and I replace it with width:985px;, the width *would not change* (assuming 985 is the pixel equivalent). On Jan 26, 3:03 pm, Matt matt.critch...@gmail.com wrote: $('#Test').css('width') ? On Jan 26, 11:46 am, Kevin Dalman kevin.dal...@gmail.com wrote: jQuery has innerHeight/Width and outerHeight/Width methods, but is there a method that can return a 'CSS Height/Width'. A CSS width is the width that would be applied via CSS to achieve a given 'outer width'. This value will differ depending on the box model and other older browser idiosyncracies. Here is an example... DIV#Test { width: 90%; height: auto; padding: 7px; margin: 11px; border: 3px solid #000; } DIV id=Test line1 BR line 2 BR line 3 /DIV Now I want to increase the DIV width height by 1-pixel. To do so, I need the current 'pixel width/height' that is equivent to its current size. AFAIK, $(#Test).innerWidth() will not address this. Is there another dimension method that can? I already have a custom function to calculate this, but I'm wondering if I am missing something in jQuery that would simplify my code? If not, I may suggest such a method for jQuery, but want to be sure it doesn't already exist! Does anyone have knowledge of this? /Kevin- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: how to use onfocus event with jQuery ?
http://docs.jquery.com/Events/focus On Jan 28, 9:28 pm, Alex blackange...@gmail.com wrote: hi all, i'm new to jQuery, how to use onfocus event with jQuery ? Could you give me a demo ? Thank you! Alex
[jQuery] Re: $.Ajax giving problem in IE
can u post your code? On Jan 28, 10:41 pm, AbhishEk mithuabh...@gmail.com wrote: Hi, i have a page on which i have used$.ajax for asynchronous call which works quite f9 in firefox but it is not working in IE .. Plz help abhishek
[jQuery] Re: A general question about troubleshooting Jquery
you can also debug javascript with visual studio On Jan 28, 2:37 pm, Vaughn meest...@gmail.com wrote: I'm new to Jquery, but one thing I'm having trouble with is troubleshooting my code. For example, I have a page, and things work until I perform a certain action. No errors result, inspecting the generated source shows nothing that should prevent it from working... I can't find a way to diagnose the problem. ( details here, if you want more info...http://groups.google.com/group/jquery-plugins/browse_thread/thread/fa... ) What kind of testing methodology (or methodologies) should be used with Jquery to discover what has changed in a page that prevents code from running as expected?
[jQuery] Re: Passing an HTML page fragment as an Ajax XML field
You could do it this way: http://docs.jquery.com/Ajax/load You can pass a selector to load() to pick what you want from the response. On Jan 27, 7:29 am, JS London jus...@alphainitiatives.com wrote: Hi, I would like to pass an fragment of HTML as a field in my Ajax response and then insert this into the DOM. For example if part of the Ajax XML response (ajax_xml) is as follows: cityid2/cityid frag div class=cityboxh2 class=citytitleCity of London/h2p class=descLondon is on the River Thames/p/div /frag (I want to generate the fragment markup server-side for consistency.) I can extract the HTML fragment as follows: var frag=$(ajax_xml).find(frag).children(); But when I come to insert it into the DOM, neither of these work: a. $(#myid).after(frag); b. $(#myid).after($(frag).html()); (it states in the JQuery website documentation that (b) will not work) Is there a way of doing this without having to escape the original HTML fragment? (which I want to avoid) Any help much appreciated, many thanks JS, London
[jQuery] Re: Passing an HTML page fragment as an Ajax XML field
You could also try changing frag to div class=frag instead. For example this worked in firefox but not IE: body script src=jquery.js/script frag div class=cityboxh2 class=citytitleCity of London/h2p class=descLondon is on the River Thames/p/div /frag hr/ div id=myid/div script var frag = $(frag).children(); $(#myid).after(frag); /script /body When I switched frag to span, for example, it worked. On Jan 27, 7:29 am, JS London jus...@alphainitiatives.com wrote: Hi, I would like to pass an fragment of HTML as a field in my Ajax response and then insert this into the DOM. For example if part of the Ajax XML response (ajax_xml) is as follows: cityid2/cityid frag div class=cityboxh2 class=citytitleCity of London/h2p class=descLondon is on the River Thames/p/div /frag (I want to generate the fragment markup server-side for consistency.) I can extract the HTML fragment as follows: var frag=$(ajax_xml).find(frag).children(); But when I come to insert it into the DOM, neither of these work: a. $(#myid).after(frag); b. $(#myid).after($(frag).html()); (it states in the JQuery website documentation that (b) will not work) Is there a way of doing this without having to escape the original HTML fragment? (which I want to avoid) Any help much appreciated, many thanks JS, London
[jQuery] Re: Losing event handlers when appending same element multiple times
It actually makes sense, because you've only created one element here: var handle = $('spanClick me/span'); By doing append() on a set of elements using this one element, it may be implying you would like to clone this element for the elements after the first one, but it's not completely obvious. Something that may make more sense is that the one element ends up in the very last li. Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? On Jan 27, 9:48 am, errant d.cheka...@gmail.com wrote: Hi Eric, thanks for response. Yes, it works that way, but it's kind of unflexible and may be impossible to implement when dealing with more complex code, don't you think? On 27 янв, 17:29, Eric Garside gars...@gmail.com wrote: I believe it has to do with the new event propogation model implemented with 1.3 Instead, try using a living event: ul li/li li/li li/li li/li li/li /ul $('ul li span').live('click', function(){ // ... }); $('ul li').append('spanClick me/span'); That should work. On Jan 27, 8:15 am, errant d.cheka...@gmail.com wrote: Here is the code: HTML: ul li/li li/li li/li li/li li/li /ul JS: $(function(){ var handle = $('spanClick me/span'); handle.click(function() { alert('Thanks'); }); $('ul li').append(handle); }); With jQuery 1.2.6, each time I click on any list's element it shows alert. With 1.3.1 in FF3, Safari 3 Opera 9.63 alert is only displaying when I click on first element. In IE6,7 everything is ok. Is this some kind of bug?- Hide quoted text - - Show quoted text -
[jQuery] Re: Losing event handlers when appending same element multiple times
live() works, but it involves extra steps. For example something like el.click(fn,true) maybe be easier to remember for some. Also live differs from what I was thinking in that it continues to bind events to the handler based on the selector. I was thinking it should only be cloned that one time (with the event handlers included). What if, for some reason, elements of a different type were added to the same container, but had a different functionality? live() wouldn't necessarily be what you would want. On Jan 27, 10:15 am, Eric Garside gars...@gmail.com wrote: Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? There is. That's exactly what live() does. You just define it before runtime. On Jan 27, 10:06 am, jay jay.ab...@gmail.com wrote: It actually makes sense, because you've only created one element here: var handle = $('spanClick me/span'); By doing append() on a set of elements using this one element, it may be implying you would like to clone this element for the elements after the first one, but it's not completely obvious. Something that may make more sense is that the one element ends up in the very last li. Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? On Jan 27, 9:48 am, errant d.cheka...@gmail.com wrote: Hi Eric, thanks for response. Yes, it works that way, but it's kind of unflexible and may be impossible to implement when dealing with more complex code, don't you think? On 27 янв, 17:29, Eric Garside gars...@gmail.com wrote: I believe it has to do with the new event propogation model implemented with 1.3 Instead, try using a living event: ul li/li li/li li/li li/li li/li /ul $('ul li span').live('click', function(){ // ... }); $('ul li').append('spanClick me/span'); That should work. On Jan 27, 8:15 am, errant d.cheka...@gmail.com wrote: Here is the code: HTML: ul li/li li/li li/li li/li li/li /ul JS: $(function(){ var handle = $('spanClick me/span'); handle.click(function() { alert('Thanks'); }); $('ul li').append(handle); }); With jQuery 1.2.6, each time I click on any list's element it shows alert. With 1.3.1 in FF3, Safari 3 Opera 9.63 alert is only displaying when I click on first element. In IE6,7 everything is ok. Is this some kind of bug?- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: UI Dialog Position Based on Link Position
Also will want to compare position of mouse to width of window and if the difference is less than the width of the dialog then position tooltip to right, else to the left Here is the link for the width() property: http://docs.jquery.com/CSS/width On Jan 27, 9:45 am, Adam apcau...@gmail.com wrote: I'd like to open a dialog when a link is clicked, and have the dialog open beside the link, similar to a tooltip. Are there any examples on how to calculate the position where the dialog should show up? What's the best way to position it so that it shows within the confines of the page (i.e. if the link is right- aligned, the dialog should popup to the left of the link, etc.).
[jQuery] Re: Losing event handlers when appending same element multiple times
It's not that I prefer it. I think live()/die() makes sense because the event lives on for all matching selectors. What the true arguement would do it give a way to clone the element and it's handler just that one time. On Jan 27, 10:50 am, Eric Garside gars...@gmail.com wrote: Give them a different selector? $('.click1').live('click', function(){}); $('.click2').live('click', function(){}); Would handle the problem easily. Remember, you can always add extra, non-style based classes which you can use as selectors for events or effects. Also, I'm not sure I understand your objection. If I understand correctly, you're saying you'd prefer: var span = $('spanClick me/span').click(function(){}, true); $('ul li').append(span); Instead of: $('ul li span').live('click', function(){}); $('ul li').append('spanClick me/span'); The live syntax is, at least in this example, shorter, more efficient, cleaner, and easier to use. Perhaps it's just that I'm not understanding a situation in which I'd run into trouble using it over an object, kept in memory, with a forced clone(true) bound to it. Can you think of any? On Jan 27, 10:36 am, jay jay.ab...@gmail.com wrote: live() works, but it involves extra steps. For example something like el.click(fn,true) maybe be easier to remember for some. Also live differs from what I was thinking in that it continues to bind events to the handler based on the selector. I was thinking it should only be cloned that one time (with the event handlers included). What if, for some reason, elements of a different type were added to the same container, but had a different functionality? live() wouldn't necessarily be what you would want. On Jan 27, 10:15 am, Eric Garside gars...@gmail.com wrote: Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? There is. That's exactly what live() does. You just define it before runtime. On Jan 27, 10:06 am, jay jay.ab...@gmail.com wrote: It actually makes sense, because you've only created one element here: var handle = $('spanClick me/span'); By doing append() on a set of elements using this one element, it may be implying you would like to clone this element for the elements after the first one, but it's not completely obvious. Something that may make more sense is that the one element ends up in the very last li. Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? On Jan 27, 9:48 am, errant d.cheka...@gmail.com wrote: Hi Eric, thanks for response. Yes, it works that way, but it's kind of unflexible and may be impossible to implement when dealing with more complex code, don't you think? On 27 янв, 17:29, Eric Garside gars...@gmail.com wrote: I believe it has to do with the new event propogation model implemented with 1.3 Instead, try using a living event: ul li/li li/li li/li li/li li/li /ul $('ul li span').live('click', function(){ // ... }); $('ul li').append('spanClick me/span'); That should work. On Jan 27, 8:15 am, errant d.cheka...@gmail.com wrote: Here is the code: HTML: ul li/li li/li li/li li/li li/li /ul JS: $(function(){ var handle = $('spanClick me/span'); handle.click(function() { alert('Thanks'); }); $('ul li').append(handle); }); With jQuery 1.2.6, each time I click on any list's element it shows alert. With 1.3.1 in FF3, Safari 3 Opera 9.63 alert is only displaying when I click on first element. In IE6,7 everything is ok. Is this some kind of bug?- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Losing event handlers when appending same element multiple times
I thought the point was to avoid the each()? What's wrong with: $('ul li').append($('spanClick me!/span').click(function(){}, true); and doing $('ul li').append($('spanClick me!/span').click(function (){}); defaults the second argument to false. Or you could default it to true and it may stay more backwards- compatible with older versions. On Jan 27, 11:22 am, Eric Garside gars...@gmail.com wrote: You can already do that using clone. I can't see a need to rewrite in new code when the ability already exists in the current code. If you want to clone around your elements around and not apply new styles, just: $('ul li').each(function(){ $(this).append($('spanClick me!/span').click(function(){})) }); On Jan 27, 11:14 am, jay jay.ab...@gmail.com wrote: It's not that I prefer it. I think live()/die() makes sense because the event lives on for all matching selectors. What the true arguement would do it give a way to clone the element and it's handler just that one time. On Jan 27, 10:50 am, Eric Garside gars...@gmail.com wrote: Give them a different selector? $('.click1').live('click', function(){}); $('.click2').live('click', function(){}); Would handle the problem easily. Remember, you can always add extra, non-style based classes which you can use as selectors for events or effects. Also, I'm not sure I understand your objection. If I understand correctly, you're saying you'd prefer: var span = $('spanClick me/span').click(function(){}, true); $('ul li').append(span); Instead of: $('ul li span').live('click', function(){}); $('ul li').append('spanClick me/span'); The live syntax is, at least in this example, shorter, more efficient, cleaner, and easier to use. Perhaps it's just that I'm not understanding a situation in which I'd run into trouble using it over an object, kept in memory, with a forced clone(true) bound to it. Can you think of any? On Jan 27, 10:36 am, jay jay.ab...@gmail.com wrote: live() works, but it involves extra steps. For example something like el.click(fn,true) maybe be easier to remember for some. Also live differs from what I was thinking in that it continues to bind events to the handler based on the selector. I was thinking it should only be cloned that one time (with the event handlers included). What if, for some reason, elements of a different type were added to the same container, but had a different functionality? live() wouldn't necessarily be what you would want. On Jan 27, 10:15 am, Eric Garside gars...@gmail.com wrote: Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? There is. That's exactly what live() does. You just define it before runtime. On Jan 27, 10:06 am, jay jay.ab...@gmail.com wrote: It actually makes sense, because you've only created one element here: var handle = $('spanClick me/span'); By doing append() on a set of elements using this one element, it may be implying you would like to clone this element for the elements after the first one, but it's not completely obvious. Something that may make more sense is that the one element ends up in the very last li. Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? On Jan 27, 9:48 am, errant d.cheka...@gmail.com wrote: Hi Eric, thanks for response. Yes, it works that way, but it's kind of unflexible and may be impossible to implement when dealing with more complex code, don't you think? On 27 янв, 17:29, Eric Garside gars...@gmail.com wrote: I believe it has to do with the new event propogation model implemented with 1.3 Instead, try using a living event: ul li/li li/li li/li li/li li/li /ul $('ul li span').live('click', function(){ // ... }); $('ul li').append('spanClick me/span'); That should work. On Jan 27, 8:15 am, errant d.cheka...@gmail.com wrote: Here is the code: HTML: ul li/li li/li li/li li/li li/li /ul JS: $(function(){ var handle = $('spanClick me/span'); handle.click(function() { alert('Thanks'); }); $('ul li').append(handle); }); With jQuery 1.2.6, each time I click on any list's element it shows alert. With 1.3.1 in FF3, Safari 3 Opera 9.63 alert is only
[jQuery] Re: Losing event handlers when appending same element multiple times
of course if there are other things that may need to be customized about the event(s) in question it might make more sense to pass in an options object. On Jan 27, 11:30 am, jay jay.ab...@gmail.com wrote: I thought the point was to avoid the each()? What's wrong with: $('ul li').append($('spanClick me!/span').click(function(){}, true); and doing $('ul li').append($('spanClick me!/span').click(function (){}); defaults the second argument to false. Or you could default it to true and it may stay more backwards- compatible with older versions. On Jan 27, 11:22 am, Eric Garside gars...@gmail.com wrote: You can already do that using clone. I can't see a need to rewrite in new code when the ability already exists in the current code. If you want to clone around your elements around and not apply new styles, just: $('ul li').each(function(){ $(this).append($('spanClick me!/span').click(function(){})) }); On Jan 27, 11:14 am, jay jay.ab...@gmail.com wrote: It's not that I prefer it. I think live()/die() makes sense because the event lives on for all matching selectors. What the true arguement would do it give a way to clone the element and it's handler just that one time. On Jan 27, 10:50 am, Eric Garside gars...@gmail.com wrote: Give them a different selector? $('.click1').live('click', function(){}); $('.click2').live('click', function(){}); Would handle the problem easily. Remember, you can always add extra, non-style based classes which you can use as selectors for events or effects. Also, I'm not sure I understand your objection. If I understand correctly, you're saying you'd prefer: var span = $('spanClick me/span').click(function(){}, true); $('ul li').append(span); Instead of: $('ul li span').live('click', function(){}); $('ul li').append('spanClick me/span'); The live syntax is, at least in this example, shorter, more efficient, cleaner, and easier to use. Perhaps it's just that I'm not understanding a situation in which I'd run into trouble using it over an object, kept in memory, with a forced clone(true) bound to it. Can you think of any? On Jan 27, 10:36 am, jay jay.ab...@gmail.com wrote: live() works, but it involves extra steps. For example something like el.click(fn,true) maybe be easier to remember for some. Also live differs from what I was thinking in that it continues to bind events to the handler based on the selector. I was thinking it should only be cloned that one time (with the event handlers included). What if, for some reason, elements of a different type were added to the same container, but had a different functionality? live() wouldn't necessarily be what you would want. On Jan 27, 10:15 am, Eric Garside gars...@gmail.com wrote: Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? There is. That's exactly what live() does. You just define it before runtime. On Jan 27, 10:06 am, jay jay.ab...@gmail.com wrote: It actually makes sense, because you've only created one element here: var handle = $('spanClick me/span'); By doing append() on a set of elements using this one element, it may be implying you would like to clone this element for the elements after the first one, but it's not completely obvious. Something that may make more sense is that the one element ends up in the very last li. Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? On Jan 27, 9:48 am, errant d.cheka...@gmail.com wrote: Hi Eric, thanks for response. Yes, it works that way, but it's kind of unflexible and may be impossible to implement when dealing with more complex code, don't you think? On 27 янв, 17:29, Eric Garside gars...@gmail.com wrote: I believe it has to do with the new event propogation model implemented with 1.3 Instead, try using a living event: ul li/li li/li li/li li/li li/li /ul $('ul li span').live('click', function(){ // ... }); $('ul li').append('spanClick me/span'); That should work. On Jan 27, 8:15 am, errant d.cheka...@gmail.com wrote: Here is the code: HTML: ul li/li li/li li/li li/li li/li /ul JS: $(function(){ var handle = $('spanClick me/span
[jQuery] Re: Losing event handlers when appending same element multiple times
Some may see the fact that future handlers are automatically assigned based on a given selector as a side-effect if it were incorporated this way on a set of DOM elements (though using live()/die() makes more sense). All I'm saying is that if append is going to automatically clone a DOM element if the selected DOM set is greater than 1, then why not optionally allow them to clone that element's handler(s) as well? Also if there are other behaviors that would be desirable in terms of event binding on a set of DOM elements (such as propogation behavior perhaps) they could also be provided using these options. On Jan 27, 12:07 pm, Eric Garside gars...@gmail.com wrote: Honestly, I'm at a loss why I'd want that kind of temporary cloned functionality when you could just use live to achieve the same functionality with nowhere near the limitations of the implementation you've described here. It's also nice to be able to excise my event declarations from my dom manipulations. Again, I can't think of a situation where your method would be better in any way than using a live event. On Jan 27, 11:37 am, jay jay.ab...@gmail.com wrote: of course if there are other things that may need to be customized about the event(s) in question it might make more sense to pass in an options object. On Jan 27, 11:30 am, jay jay.ab...@gmail.com wrote: I thought the point was to avoid the each()? What's wrong with: $('ul li').append($('spanClick me!/span').click(function(){}, true); and doing $('ul li').append($('spanClick me!/span').click(function (){}); defaults the second argument to false. Or you could default it to true and it may stay more backwards- compatible with older versions. On Jan 27, 11:22 am, Eric Garside gars...@gmail.com wrote: You can already do that using clone. I can't see a need to rewrite in new code when the ability already exists in the current code. If you want to clone around your elements around and not apply new styles, just: $('ul li').each(function(){ $(this).append($('spanClick me!/span').click(function(){})) }); On Jan 27, 11:14 am, jay jay.ab...@gmail.com wrote: It's not that I prefer it. I think live()/die() makes sense because the event lives on for all matching selectors. What the true arguement would do it give a way to clone the element and it's handler just that one time. On Jan 27, 10:50 am, Eric Garside gars...@gmail.com wrote: Give them a different selector? $('.click1').live('click', function(){}); $('.click2').live('click', function(){}); Would handle the problem easily. Remember, you can always add extra, non-style based classes which you can use as selectors for events or effects. Also, I'm not sure I understand your objection. If I understand correctly, you're saying you'd prefer: var span = $('spanClick me/span').click(function(){}, true); $('ul li').append(span); Instead of: $('ul li span').live('click', function(){}); $('ul li').append('spanClick me/span'); The live syntax is, at least in this example, shorter, more efficient, cleaner, and easier to use. Perhaps it's just that I'm not understanding a situation in which I'd run into trouble using it over an object, kept in memory, with a forced clone(true) bound to it. Can you think of any? On Jan 27, 10:36 am, jay jay.ab...@gmail.com wrote: live() works, but it involves extra steps. For example something like el.click(fn,true) maybe be easier to remember for some. Also live differs from what I was thinking in that it continues to bind events to the handler based on the selector. I was thinking it should only be cloned that one time (with the event handlers included). What if, for some reason, elements of a different type were added to the same container, but had a different functionality? live() wouldn't necessarily be what you would want. On Jan 27, 10:15 am, Eric Garside gars...@gmail.com wrote: Perhaps there should be an optional boolean passed to the event handlers to specify carrying over event handlers like there is with the clone() method? There is. That's exactly what live() does. You just define it before runtime. On Jan 27, 10:06 am, jay jay.ab...@gmail.com wrote: It actually makes sense, because you've only created one element here: var handle = $('spanClick me/span'); By doing append() on a set of elements using this one element, it may be implying you would like to clone this element for the elements after the first one, but it's not completely obvious. Something that may
[jQuery] Re: what would be the opposite of top.frames as a jquery selector context?
Look at the test case I made here and let me know if it helps: http://jquery.nodnod.net/cases/73 On Jan 27, 3:36 pm, jquertil til...@gmail.com wrote: If i want to do something in a parent frame, I would do this: $('#myDiv', top.document).hide(); but what about this following scenario? I'm inside a frame that was created like so: $('body', top.document).append('iframe id=myiframe/iframe'); inside myiframe, I now want to know the id of my iframe, because I would not know it. All I am able to see in the DOM is the topmost document. I could traverse through all the iframes and get their ID's but that's useless because I wouldn't know which of them is the one I'm currently in. I suppose I'm simply trying to pass a variable to a child frame so it becomes available on the frame's document.onload().
[jQuery] Re: what would be the opposite of top.frames as a jquery selector context?
the $(frames.frameName.document).ready is not actually working on firefox.. you would probably have to put $(document).ready in the src page and poll it to see if the document is actually ready On Jan 27, 4:27 pm, jay jay.ab...@gmail.com wrote: Look at the test case I made here and let me know if it helps: http://jquery.nodnod.net/cases/73 On Jan 27, 3:36 pm, jquertil til...@gmail.com wrote: If i want to do something in a parent frame, I would do this: $('#myDiv', top.document).hide(); but what about this following scenario? I'm inside a frame that was created like so: $('body', top.document).append('iframe id=myiframe/iframe'); inside myiframe, I now want to know the id of my iframe, because I would not know it. All I am able to see in the DOM is the topmost document. I could traverse through all the iframes and get their ID's but that's useless because I wouldn't know which of them is the one I'm currently in. I suppose I'm simply trying to pass a variable to a child frame so it becomes available on the frame's document.onload().- Hide quoted text - - Show quoted text -
[jQuery] Re: what would be the opposite of top.frames as a jquery selector context?
This seemed to work on FF and IE: $('#myiframe')[0].onload=function(){ $(body,frames.frmName.document).html('test') } On Jan 27, 3:36 pm, jquertil til...@gmail.com wrote: If i want to do something in a parent frame, I would do this: $('#myDiv', top.document).hide(); but what about this following scenario? I'm inside a frame that was created like so: $('body', top.document).append('iframe id=myiframe/iframe'); inside myiframe, I now want to know the id of my iframe, because I would not know it. All I am able to see in the DOM is the topmost document. I could traverse through all the iframes and get their ID's but that's useless because I wouldn't know which of them is the one I'm currently in. I suppose I'm simply trying to pass a variable to a child frame so it becomes available on the frame's document.onload().
[jQuery] Re: jquery not working at all after upgrade to 1.3.1
Yes, and on top of that I put an alert in the jquery-1.3.1.js to see if it was finding the file correctly and it is, I got the alert before the page loaded. On Jan 23, 8:20 pm, Mike Alsup mal...@gmail.com wrote: This is the same error I get when I was building the app and the id, gid3 in this case, did not exist on the page. It does exist, but is hidden. I tried unhiding it and it didnt change anything. I can toggle between 1.2.6 and 1.3.1 and watch as it works, then doesn't work. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; htmlheadtitle/titlescript type=text/javascript language=JavaScript function columnMove(order,scope){ var params = ; if(scope != null) { params += page_scope= + scope; } $.ajax({ type: GET, url: , data: params }); };; /script /scriptscript type=text/javascript language=JavaScript$ (document).ready(function(){$('#gid3').flexigrid();}); /script /headbody onload=DynarchMenu.setup('hmenu_01',{ context: true, electric: 500, tooltips: true });FormUtil.focusOnFirst ('ttr01_con0');DynarchMenu.setup('hmenu_02',{ electric: true });FormUtil.focusOnFirst(document) onunload=$ ('#gid3').flexDestroy(); /body/html And you're including jQuery? Are you using Firebug? Can you set a breakpoint and/or verify that the scripts have all loaded correctly?
[jQuery] Re: Continuing to Seek Rounded Corners on Absolutely Positioned Elements that Work in IE7
could this be why?: Note that if gradients are used, you will need a min-height (or fixed height) rule on the body of the dialog. If these examples appear *funny at the bottom*, it is because they do not enforce the min-height rule. On Mon, Jan 26, 2009 at 12:33 PM, Vik v...@mindspring.com wrote: The latest approach I'm trying uses a more old-school technique, described here: http://www.schillmania.com/content/projects/even-more-rounded-corners/ For most uses, it works very well. But for absolutely positioned objects, one of the divs seems to disappear in IE7. Here's a demo using it with an absolutely positioned object: http://www.flavorzoom.com/schillmania_tryout/temp.html It looks great in Firefox, but not in IE7. Is there a way to tweak the CSS to get this to work in IE7? Thanks in advance to all for any thoughts!
[jQuery] Re: Implementing a Knob Control
To add canvas support to IE you can use the following script (slower, but works): http://code.google.com/p/explorercanvas/ On Mon, Jan 26, 2009 at 2:41 PM, Eric Garside gars...@gmail.com wrote: Canvas is probably the most elegant way to go, especially given the type of knobs you want. My suggestion is to find a decent resolution image of the knob you want, then use jquery and canvas to move the knob, and just keep track of the position. Be aware though, the mouse isn't really well designed for a knob kind of motion. On Jan 26, 1:56 pm, legofish pen...@gmail.com wrote: by the way by this approach I meant the second example on that page. On Jan 26, 1:54 pm, legofish pen...@gmail.com wrote: James, yes I mean a rotary control. Eric, here's a real-world example of what I'm trying to implement: http://www.niji.or.jp/home/k-nisi/sa-9900-h.jpg I'm looking for control knobs such as those found on a stereo; both continuous ones such as a volume knob, and n-step knobs such as the function knob in that picture, where the knob can only be rotated in n steps. I found some leads which I was going to try. I was going to mix this approach: http://blog.circlecube.com/2008/03/tutorial/interactive-spin-actionsc... with the jquery rotate plugin: http://stackoverflow.com/questions/365820/howto-rotate-image-using-jq... Still, your help would be immensely appreciated. Of course I would want the knob image to look like it's rotating, but I also want the control to return a value depending on its position, similar to how a slider returns a value. Thanks again On Jan 26, 10:20 am, Eric Garside gars...@gmail.com wrote: Legofish, I've got a couple ideas which might get the job done, but they all depend on what style of knob you want. Take a look around a google image search, and see if you can find a good representation of the type of knob you want. Then we can go from there. :) On Jan 26, 10:03 am, James Hughes j.hug...@kainos.com wrote: Do you mean a gague control? IE some sort of rotary control vs a slider? From: jquery-en@googlegroups.com on behalf of legofish Sent: Mon 26/01/2009 14:49 To: jQuery (English) Subject: [jQuery] Implementing a Knob Control Hi, I need to implement a knob control for one of my projects (eg. a volume knob). Ideally I would like to use jquery. I have spent some time searching for any resources to get started. Not only I can't find anything in jquery, I can't find anything even resembling a knob implementation in javascript in general. I did find a few sites who sell VB or .net knob controls, but nothing in js. anyway, not sure if anyone can help, but any hints towards a resource or starting point would be much appreciated. This e-mail is intended solely for the addressee and is strictly confidential; if you are not the addressee please destroy the message and all copies. Any opinion or information contained in this email or its attachments that does not relate to the business of Kainos is personal to the sender and is not given by or endorsed by Kainos. Kainos is the trading name of Kainos Software Limited, registered in Northern Ireland under company number: NI19370, having its registered offices at: Kainos House, 4-6 Upper Crescent, Belfast, BT7 1NT, Northern Ireland. Registered in the UK for VAT under number: 454598802 and registered in Ireland for VAT under number: 9950340E. This email has been scanned for all known viruses by MessageLabs but is not guaranteed to be virus free; further terms and conditions may be found on our website -www.kainos.com
[jQuery] Re: AJAX data in IE
When I click any of the links I get jQuery undefined script error line 119 in IE On Jan 24, 8:20 am, Charlie22 ch...@post.cz wrote: sry it didnt work, because console.log there.. On 24 Led, 14:12, Charlie22 ch...@post.cz wrote: thx for tip, but no success. Try to check this page..http://83.240.47.84/skyrace22/pilots.php works everywhere, only IE failed.. On 24 Led, 13:38, Mike Alsup mal...@gmail.com wrote: $(function(){ $('.tablesorter').tablesorter({widgets: ['zebra']}); $('#subMenu a').click(function(){ var trida = $(this).attr('href'); console.log(trida); $('#content*').remove(); $.ajax({ url: 'pilots.php', cache: false, type: 'POST', dataType: 'html', data: 'trida='+trida, success: function(html){ $('#content').append(html)} }); return false; }); }); this code works great, but not in IE. Problem is causing by value data. If I set: data: 'trida=15', than everything goes OK, but if I set valeu from variable, IE return only a little part of requesting page. So what is wrong in my AJAX code? Try using an object for your data arg so that jQuery properly encodes the values. So instead of: data: 'trida='+trida, try this: data: { trida: trida },- Skrýt citovaný text - - Zobrazit citovaný text -- Skrýt citovaný text - - Zobrazit citovaný text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Odd dialog bug
I've used negative values on IE7 before.. Is a different DOCTYPE possible? On Jan 24, 7:42 am, Mike Alsup mal...@gmail.com wrote: $('#' + popupId).dialog({ autoOpen: true, resizable : false, bgiframe : true, position : [pos['x'], pos['y']], width: 'auto', height: 'auto', minHeight: 100, minWidth: 100, draggable : false, stack : true, show : 'slideDown(slow)', hide : 'slideUp(slow)', close: function(event, ui){setLinkText(elementId, event, ui)} }); ++ The dialog markup: ++ form id=map-params table class=popup id=popup-3 tr tdinput type=checkbox name=categories value=1 checked=checked //td tdimg src=http://localhost/images/people_20_20.png; height=20px width=20px //td tdServicesnbsp;ànbsp;lanbsp;personne/td /tr tr tdinput type=checkbox name=categories value=2 checked=checked //td tdimg src=http://localhost/images/car_20_20.png; height=20px width=20px //td tdAutomobile/td /tr tr tdinput type=checkbox name=categories value=3 checked=checked //td tdimg src=http://localhost/images/sport_20_20.png; height=20px width=20px //td tdSport/td /tr tr tdinput type=checkbox name=categories value=4 checked=checked //td tdimg src=http://localhost/images/computer_20_20.png; height=20px width=20px //td tdInformatique/td /tr tr tdinput type=checkbox name=categories value=5 checked=checked //td tdimg src=http://localhost/images/house_20_20.png; height=20px width=20px //td tdVotre chez-soi/td /tr trtd colspan=3a id=all-checkboxes href=javascript:void (0);Select all/a/td/tr /table /form ++ In IE7 (firefox spits out the dialog without hesitation), the code breaks at creation of the dialog: the dialog is not shown. Further investigation using Visual Web Dev indicates that at line 1048 of jquery.js (v1.3.1), an invalid value is set (minHeight = -47px), a negative value. May be it's proper within the framework, but IE chokes on it at odd times. In this case, I just have to remove the last row of the table: trtd colspan=3a id=all-checkboxes href=javascript:void (0);Select all/a/td/tr And it works... sometimes. When it does not, the minHeight value is again a negative value, -23px. I then remove another table row, and it's pretty much stable from then on. Thanks for any help. To Hi To, You may want to post this to the UI discussion group as well: http://groups.google.com/group/jquery-ui/topics- Hide quoted text - - Show quoted text -
[jQuery] Re: Scale effect and hover
One way would be to create a boolean property on the rollover object, which starts as true, and if this value is true, execute your function and then set the property to false within the function. On Jan 24, 9:12 am, -=AmBaRaDaN=- gandi.ma...@gmail.com wrote: Wonderful Mike, that's what i was looking for! Thanks too Jay and Mauricio, but i was looking for something more scalable, for tons of thumbnails, with centered position scale! Anyway, is there a way to execute just one time a function within the hover event? (and no repeated multiple times during the hover state) Thanks all you On Jan 24, 1:59 am, Mike Alsup mal...@gmail.com wrote: Hi guys! I'm looking for a simple image hover effect, but with the scale effect... I just want make an image bigger on mouse over. This might help: http://www.malsup.com/jquery/hoverpulse/- Hide quoted text - - Show quoted text -
[jQuery] Re: Can JQuery solve the iframe height=100% problem?
html,body{height:100%} sometimes works.. try googling it.. getting height 100% for any element is a common problem.. On Jan 24, 8:15 pm, laredotorn...@zipmail.com laredotorn...@zipmail.com wrote: Hi, I'm trying to get my iframe to occupy 100% of its parent block element. But the height=100% attribute in CSS isn't doing the trick. Here's my HTML td width=177 height=100% valign=top class=content- ruleiframe id=fileTreeIframe style=border:0px none #ff; src=file_tree.php border=0 width=100% scroll=auto/iframe/ td and the CSS ... iframe { display:block; height:100%; width:100%; border:none; } It doesn't look good right now --http://screencast.com/t/mIzGnUikC. Can JQuery help me make my iframe occupy 100% of its parent element? Thanks, - Dave
[jQuery] General drag drop question without UI plugin
Is there a way to determine a drop container without looping through each container and comparing absolute positions? This is the only solution mentioned in this article: http://www.webreference.com/programming/javascript/mk/column2/2.html I don't want to have to move the item being dragged out of the way of the cursor so that i have event.target available. I'm thinking it can be looked up some how with a hash table so that it is O(1). I suppose we can assume that the containers do not overlap.. I suppose if I store for containers i in (0,N)..: container[i].x0 //top left point container[i].y0 container[i].x1 //bottom right point container[i].y1 then I generate javascript like this perhaps: switch(pos){ case pos.xcontainer0x0pos.ycontainer0x0pos.xcontainer0x1pos.ycontainer0y1: return container[0]; ..etc } ..but then I would have to eval this, and I'm not sure if there would be any performance gain..would the switch generate a hash table? Also, would container[0] even be accessible inside an eval. Is there a way to map the position values to a hashtable for all containers without looping?
[jQuery] Re: Events. .click() vs. .onclick
this should work: $(#elementID).click(function(){alert('clicked')}); On Jan 23, 10:20 am, KidsKilla kidski...@gmail.com wrote: Hi everyone! I have a problem with binding events in jQuery. I didn't figured out why, but when i'm tryin to bind a callback to links ( $(elm).click (function() ), it doesn't works. but works fine with elm.onclick = function() ... the same thing in 1.2.6 and 1.3.1, IE and FF... The question is: what can it be? it seems like an error with innerHTML or somethng else, but I cant find out what happening...
[jQuery] Re: sd
qwert On Jan 23, 7:10 am, Agile Consulting agile.scrapp...@gmail.com wrote: asd
[jQuery] Re: TableSorter, Turning Sort Off
If you just postback the page, the table should be restored to the original state. Otherwise, if you have a unique id for each row you could try creating a hash table which returns the unique id based on the row number (create the hash table when page is first loaded). Then you could just loop through the row numbers and insert each TR based on the unique id that is returned using the DOM. As for turning it off, you could simply save the old TH event handlers and replace them with function(){return false;} temporarily. On Jan 23, 10:56 am, NRutman nathan.rut...@gmail.com wrote: Hello, I'm considering using the TableSorter plugin (http://tablesorter.com) for one of my projects, but I need to reconcile one thing: does anyone know how I can revert the sort back to the original? Or even, how to turn the sort-state to OFF, so that no header is selected and it doesn't try to sort? That way I could at least reload the table from the original data array. Any suggestions? Thanks, -Nate
[jQuery] Re: TableSorter, Turning Sort Off
I amend what I said. A hashtable is not necessary for going from row number to unique id, an array is fine. Going from unique id to row number, however, is necessary. On Jan 23, 11:16 am, jay jay.ab...@gmail.com wrote: If you just postback the page, the table should be restored to the original state. Otherwise, if you have a unique id for each row you could try creating a hash table which returns the unique id based on the row number (create the hash table when page is first loaded). Then you could just loop through the row numbers and insert each TR based on the unique id that is returned using the DOM. As for turning it off, you could simply save the old TH event handlers and replace them with function(){return false;} temporarily. On Jan 23, 10:56 am, NRutman nathan.rut...@gmail.com wrote: Hello, I'm considering using the TableSorter plugin (http://tablesorter.com) for one of my projects, but I need to reconcile one thing: does anyone know how I can revert the sort back to the original? Or even, how to turn the sort-state to OFF, so that no header is selected and it doesn't try to sort? That way I could at least reload the table from the original data array. Any suggestions? Thanks, -Nate- Hide quoted text - - Show quoted text -
[jQuery] jquery not working at all after upgrade to 1.3.1
I have various jquery apps. In 1.3.1 I get the error $ ('#id3').functionName is not a function. I switch to 1.2.6 and everything works fine. Anyone else running into this?
[jQuery] Re: Events. .click() vs. .onclick
Are you including any other js files? Perhaps it's confused about $. Try a simple html file like this: html head script src=jquery-1.2.6.js/script script $(function(){ $(#elementID).click(function(){alert('clicked')}); }); /script /head body div id=elementIDasdf/div /body /html On Jan 23, 10:20 am, KidsKilla kidski...@gmail.com wrote: Hi everyone! I have a problem with binding events in jQuery. I didn't figured out why, but when i'm tryin to bind a callback to links ( $(elm).click (function() ), it doesn't works. but works fine with elm.onclick = function() ... the same thing in 1.2.6 and 1.3.1, IE and FF... The question is: what can it be? it seems like an error with innerHTML or somethng else, but I cant find out what happening...
[jQuery] Re: jquery not working at all after upgrade to 1.3.1
Unfortunately, no, classified type site. Here is code though with details removed that may be problematic. There are 2 function using jquery, flexigrid, and a function I wrote called flexDestroy. This is the same error I get when I was building the app and the id, gid3 in this case, did not exist on the page. It does exist, but is hidden. I tried unhiding it and it didnt change anything. I can toggle between 1.2.6 and 1.3.1 and watch as it works, then doesn't work. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd htmlheadtitle/titlescript type=text/javascript language=JavaScript function columnMove(order,scope){ var params = ; if(scope != null) { params += page_scope= + scope; } $.ajax({ type: GET, url: , data: params }); };; /script /scriptscript type=text/javascript language=JavaScript$ (document).ready(function(){$('#gid3').flexigrid();}); /script /headbody onload=DynarchMenu.setup('hmenu_01',{ context: true, electric: 500, tooltips: true });FormUtil.focusOnFirst ('ttr01_con0');DynarchMenu.setup('hmenu_02',{ electric: true });FormUtil.focusOnFirst(document) onunload=$ ('#gid3').flexDestroy(); /body/html On Jan 23, 11:35 am, Mike Alsup mal...@gmail.com wrote: I have various jquery apps. In 1.3.1 I get the error $ ('#id3').functionName is not a function. I switch to 1.2.6 and everything works fine. Anyone else running into this? Can you please post a link that demonstrates the problem you're having?
[jQuery] Re: neccessity of binding update after adding html dynamically
If you do: $(anyElement).html(div id=blahblah/div); then you will need to do: $('#bla').bind(click,function(){.}); after the html() call. Does this answer your question? On Jan 23, 11:30 am, aldana ald...@gmx.de wrote: I am binding elements inside document.ready(): $('#bla').bind(click,function(){.}); At some point html is added dynamically: anyElement.html= would then a callback added to the dom representation of the dynamically added snippet also or would i need again to call $('#bla').bind(...)? thanks. - manuel aldana aldana((at))gmx.de software-engineering blog:http://www.aldana-online.de -- View this message in context:http://www.nabble.com/neccessity-of-binding-update-after-adding-html-... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Query on jQuery object?
Would mydiv.children(#childdiv).css(font-weight, bold); work? On Jan 23, 12:57 pm, corb corbinc...@gmail.com wrote: This may obvious, but I haven't seen any examples that fit what I'm trying to do. In many places in my code, I will select an element once into a var and make necessary changes. What I can't seem to figure out or find documentation on is querying on an existing object. Here's what I have to do now: $().ready(function(){ $(#mydiv).click(function(){alert('hello')}); $(#mydiv .childdiv).css(font-weight, bold);} seems a tad inefficient to make two trips through the DOM. Here's what I would like to do: $().ready(function(){ var mydiv = $(#mydiv); mydiv.click(function(){alert('hello')}); // here's where I'm lost // find all the element identified as childdiv and set its css mydiv(#childdiv).css(font-weight, bold); // is there a way to do this with out multiple trips to the DOM? }- Hide quoted text - - Show quoted text -
[jQuery] Re: Query on jQuery object?
That makes more sense.. children() will only do immediate descendents. You could also do mydiv.find(expr) as well I suppose. On Jan 23, 1:04 pm, Eric Garside gars...@gmail.com wrote: var mydiv = $('#mydiv'); $('.childdiv', mydiv).css('font-weght', 'bold'); On Jan 23, 12:57 pm, corb corbinc...@gmail.com wrote: This may obvious, but I haven't seen any examples that fit what I'm trying to do. In many places in my code, I will select an element once into a var and make necessary changes. What I can't seem to figure out or find documentation on is querying on an existing object. Here's what I have to do now: $().ready(function(){ $(#mydiv).click(function(){alert('hello')}); $(#mydiv .childdiv).css(font-weight, bold);} seems a tad inefficient to make two trips through the DOM. Here's what I would like to do: $().ready(function(){ var mydiv = $(#mydiv); mydiv.click(function(){alert('hello')}); // here's where I'm lost // find all the element identified as childdiv and set its css mydiv(#childdiv).css(font-weight, bold); // is there a way to do this with out multiple trips to the DOM? }- Hide quoted text - - Show quoted text -
[jQuery] Re: jquery not working at all after upgrade to 1.3.1
This was never a problem before, was something changed in 1.3 that would make this necessary? Reason for both ways is large application built OOP in php. Just made it so page has no body onloads and problem persists. I did change the flexDestroy function to be off the jquery function, that was a nice find. On Jan 23, 12:54 pm, seasoup seas...@gmail.com wrote: Well, one issue might be that you are using onload in the body tag why not use the jQuery ready function that you are already using above? $(document).ready(function(){ $('#gid3').flexigrid(); DynarchMenu.setup('hmenu_01',{ context: true, electric: 500, tooltips: true }); FormUtil.focusOnFirst('ttr01_con0'); DynarchMenu.setup('hmenu_02',{ electric: true }); FormUtil.focusOnFirst(document) }); Same with the unload in the body tag. $(document).unload(function(){ $('#gid3').flexDestroy();} On Jan 23, 9:04 am, Jay leffu...@hotmail.com wrote: Unfortunately, no, classified type site. Here is code though with details removed that may be problematic. There are 2 function using jquery, flexigrid, and a function I wrote called flexDestroy. This is the same error I get when I was building the app and the id, gid3 in this case, did not exist on the page. It does exist, but is hidden. I tried unhiding it and it didnt change anything. I can toggle between 1.2.6 and 1.3.1 and watch as it works, then doesn't work. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; htmlheadtitle/titlescript type=text/javascript language=JavaScript function columnMove(order,scope){ var params = ; if(scope != null) { params += page_scope= + scope; } $.ajax({ type: GET, url: , data: params }); };; /script /scriptscript type=text/javascript language=JavaScript$ (document).ready(function(){$('#gid3').flexigrid();}); /script /headbody onload=DynarchMenu.setup('hmenu_01',{ context: true, electric: 500, tooltips: true });FormUtil.focusOnFirst ('ttr01_con0');DynarchMenu.setup('hmenu_02',{ electric: true });FormUtil.focusOnFirst(document) onunload=$ ('#gid3').flexDestroy(); /body/html On Jan 23, 11:35 am, Mike Alsup mal...@gmail.com wrote: I have various jquery apps. In 1.3.1 I get the error $ ('#id3').functionName is not a function. I switch to 1.2.6 and everything works fine. Anyone else running into this? Can you please post a link that demonstrates the problem you're having?
[jQuery] Re: If object wrapped, parents can't be found?
This worked for me: head script src=jquery-1.2.6.js/script script $(function(){ $(#myEl).wrap(span/span).parents().each(function(){alert (this.tagName)}) }); /script /head body div b id=myElsomething/b /div /div /body On Jan 23, 1:24 pm, Nic Hubbard nnhubb...@gmail.com wrote: I ran into a strange problem which too me a while to figure out what was going on. I used the .wrap() function to wrap an element with a span. Then, later on in my script I wanted to find all of the parents (using .parents() or even p.arent()) of the element that I wrapped. Strangely, it would always only find the parent that was wrapped around it, and nothing higher than that, is this normal?
[jQuery] Re: neccessity of binding update after adding html dynamically
If they are already binded they should be fine.. You can move the elements around the DOM tree and they will have the same events as before.. When you're doing html() you're creating new elements, and therefore they don't have any events related to them..unless you have an onclick attribute.. but then that wouldn't be the jQuery way.. On Jan 23, 1:29 pm, aldana ald...@gmx.de wrote: yes this was it. when not using html() and setting values with normal dom-operations instead I wouldn't need to rebind, correct? jay-125 wrote: If you do: $(anyElement).html(div id=blahblah/div); then you will need to do: $('#bla').bind(click,function(){.}); after the html() call. Does this answer your question? On Jan 23, 11:30 am, aldana ald...@gmx.de wrote: I am binding elements inside document.ready(): $('#bla').bind(click,function(){.}); At some point html is added dynamically: anyElement.html= would then a callback added to the dom representation of the dynamically added snippet also or would i need again to call $('#bla').bind(...)? thanks. - manuel aldana aldana((at))gmx.de software-engineering blog:http://www.aldana-online.de -- View this message in context:http://www.nabble.com/neccessity-of-binding-update-after-adding-html-... Sent from the jQuery General Discussion mailing list archive at Nabble.com. - manuel aldana aldana((at))gmx.de software-engineering blog:http://www.aldana-online.de -- View this message in context:http://www.nabble.com/neccessity-of-binding-update-after-adding-html-... Sent from the jQuery General Discussion mailing list archive at Nabble.com.- Hide quoted text - - Show quoted text -
[jQuery] Re: getting to a variable in the parent frame - stumped
perhaps you need to do this.module = {...}? Doing var module makes it private I believe On Jan 23, 3:31 pm, jquertil til...@gmail.com wrote: I'm using frames (don't ask) and have exhausted my abilities (sniff)... here is some pseudo-code to illustrate the situation: first, CONTAINER.HTM: script src=jquery.js/script $(function(){ var module = { something1 : function(var1){ alert(var2); } } }); iframe src=iframe1.htm/iframe - now, IFRAME1.HTM script src=jquery.js/script $(function(){ $('#myDiv').click(function(){ top.frames[0].document.module.something1('hello'); // this line above is the part where I'm stuck. //why won't this darn thing cooperate and alert my variable? }); }); div id=mydivclick me/div
[jQuery] Re: getting to a variable in the parent frame - stumped
That makes sense. I think you just need document if you need to access the other frame's DOM tree. On Jan 23, 4:04 pm, jquertil til...@gmail.com wrote: oh! I got it. thanks Jay, your suggestion gave me the hint I needed to figure it out. removing var did 1/2 the trick, the second 1/2 was me realizing that now I have module as object of the top document, so top.module.something1('hello'); works. yay! this drove me crazy last night!
[jQuery] Re: Highlight onKeyUp using Cursor Keys
Here is a jquery autocomplete plugin I googled and seems to do what you want: http://www.pengoworks.com/workshop/jquery/autocomplete.htm On Jan 23, 4:00 pm, bittermonkey brakes...@gmail.com wrote: How do I initialize a hover on a A HREF tag using cursor keys in jQuery? It's similar to how google highlights its autocomplete results. So, from google.com, type the letter a in the searchbox then press the Down Arrow Key and notice how the first item in the autocomplete box gets highlighted and so on if you continue pressing it. How do I accomplish this in jQuery?
[jQuery] Re: Highlight onKeyUp using Cursor Keys
You could write something yourself fairly easily. Just update the backgroundColor css property when you press the up/down keys on your absolutely positioned element, and when you press enter perform an action that is associated with that element. On Jan 23, 4:32 pm, bittermonkey brakes...@gmail.com wrote: The code is a bit overwhelming for just the highlight functionality. Thanks anyway. On Jan 23, 4:17 pm, jay jay.ab...@gmail.com wrote: Here is a jquery autocomplete plugin I googled and seems to do what you want: http://www.pengoworks.com/workshop/jquery/autocomplete.htm On Jan 23, 4:00 pm, bittermonkey brakes...@gmail.com wrote: How do I initialize a hover on a A HREF tag using cursor keys in jQuery? It's similar to how google highlights its autocomplete results. So, from google.com, type the letter a in the searchbox then press the Down Arrow Key and notice how the first item in the autocomplete box gets highlighted and so on if you continue pressing it. How do I accomplish this in jQuery?- Hide quoted text - - Show quoted text -
[jQuery] Re: Highlight onKeyUp using Cursor Keys
No, not necessarily. You could store a reference to the selected element in a variable. You wouldn't want to have to iterate through the list of elements every time to determine if it is selected if you don't have to. On Jan 23, 4:58 pm, bittermonkey brakes...@gmail.com wrote: and to find out which element was selected, I have to check for its background? Is that right? On Jan 23, 4:49 pm, jay jay.ab...@gmail.com wrote: You could write something yourself fairly easily. Just update the backgroundColor css property when you press the up/down keys on your absolutely positioned element, and when you press enter perform an action that is associated with that element. On Jan 23, 4:32 pm, bittermonkey brakes...@gmail.com wrote: The code is a bit overwhelming for just the highlight functionality. Thanks anyway. On Jan 23, 4:17 pm, jay jay.ab...@gmail.com wrote: Here is a jquery autocomplete plugin I googled and seems to do what you want: http://www.pengoworks.com/workshop/jquery/autocomplete.htm On Jan 23, 4:00 pm, bittermonkey brakes...@gmail.com wrote: How do I initialize a hover on a A HREF tag using cursor keys in jQuery? It's similar to how google highlights its autocomplete results. So, from google.com, type the letter a in the searchbox then press the Down Arrow Key and notice how the first item in the autocomplete box gets highlighted and so on if you continue pressing it. How do I accomplish this in jQuery?- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: id question
I would assume that it doesn't like the \{0} part.. is this server- side code or something? On Jan 23, 4:56 pm, gvangass gvang...@gmail.com wrote: Hi Is there a reason why: alert($('#id\{0}___').val()); not displaying the value, also no error with Firebug but alert(document.getElementById(id{0}___).value); displays it ? The html looks like this: input id=id{0}___ type=text onblur=show_value() value=123 maxlength=10 size=10 name=id{0}___ / show_value() run the alerts above Thanks gvg
[jQuery] Re: Slide Toggle Question
I get javascript errors in IE, and the images overlap the content in firefox.. what am I looking for exactly? On Jan 23, 3:03 pm, Christian christian.swe...@gmail.com wrote: Hey everyone. I'm still a bit new to the whole jQuery world. I love what I've seen so far, and it seems fairly simple to implement on a site. I recently viewed a web site through promotion on ExpressionEngine.com, and found the slideToggle effect. I asked the web admin if they can forward me what they used to create the effect (which was exactly what I was looking for). I now have it working on my test templates, but I cannot get it to resize. My site template is at 940px, but the slider is a bit wider, and I cannot find that control anywhere in the code. You can check out the page athttp://www.usm.edu/music/index.php/testing/index/ Please keep in mind that it's a test template, so some CSS issues will exist. Also, I am using a jd.Gallery script, and it is somehow conflicting with the jQuery... Any help on this would be GREATLY appreciated. I'm not a coder by any means, so please be gentle... =)
[jQuery] Re: id question
based on this wouldn't the syntax be alert($('#id\\{0\\}___').val ()); ? On Jan 23, 5:19 pm, Mauricio \(Maujor\) Samy Silva css.mau...@gmail.com wrote: You must escape properly weird characters in ID values. Have a look at:http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_... Maurício -Mensagem Original- De: gvangass gvang...@gmail.com Para: jQuery (English) jquery-en@googlegroups.com Enviada em: sexta-feira, 23 de janeiro de 2009 19:56 Assunto: [jQuery] id question Hi Is there a reason why: alert($('#id\{0}___').val()); not displaying the value, also no error with Firebug but alert(document.getElementById(id{0}___).value); displays it ? The html looks like this: input id=id{0}___ type=text onblur=show_value() value=123 maxlength=10 size=10 name=id{0}___ / show_value() run the alerts above Thanks gvg- Hide quoted text - - Show quoted text -
[jQuery] Re: Reload Part of a Page
just reload it with whatever is in the data variable. $(#myUL).html (data) will do the trick assuming your data is just html like li1/ lili2/li On Jan 23, 12:46 pm, Good Knight kyleakni...@gmail.com wrote: Is there an easy way to reload a section of a page? I have a .post() that updates the contents of an unordered list, but i have to refresh the page to see the new contents of the UL. Anyway to have the UL reload when the .post() goes off? I am using the Impromptu plugin to run the post, but this should be just a basic jQuery issue I don't think it's a plugin question. Code can be found athttp://www.pastie.org/368851 Any ideas would be very useful!
[jQuery] Re: Scale effect and hover
this works for me.. style is bad though sorry had to do it quick: body script src=jquery.js/script a id=testsomething/a img id=scale_img src=img.gif/ script $(function(){ scaleImg = $(#scale_img); scaleImg.w = scaleImg.width(); scaleImg.hover(function(){ scaleImg.width(scaleImg.w*2); }, function(){ scaleImg.width(scaleImg.w); }); }); /script /body On Jan 23, 4:44 pm, -=AmBaRaDaN=- gandi.ma...@gmail.com wrote: Hi guys! I'm looking for a simple image hover effect, but with the scale effect... I just want make an image bigger on mouse over. I'm newbie with jQuery, and I tried this $(#scale_img).hover(function() { $(this).effect(scale, { percent: 200 });}, function() { $(this).effect(scale, { percent: 50 }); }); ..but hover state doesn't stop after one resize. I mean if I leave my mouse over, the image continue to resize. How can i stop that? Any idea to fix it? i tried also... $(#test2).hover(function () { $(this).toggle(scale, { percent: 80 }, 500); }, function(){ $(this).toggle(scale, { percent: 80 }, 500); }); ..but it's worst. (it would be wonderful if the scaling has a bounce effect in the end!!) Thx a lot anyway for all the tips!
[jQuery] Re: UI/Accordion - Possible to deep-link?
something like this might work: $(document).scrollTop(getRealTop(accordian)); function getRealTop(el){ yPos = document.getElementById(el).offsetTop; tempEl = document.getElementById(el).offsetParent; while (tempEl != null) { yPos += tempEl.offsetTop; tempEl = tempEl.offsetParent; } return yPos; } On Jan 23, 8:34 pm, bcbounders bcbound...@gmail.com wrote: Jörn, Thanks for the tip... looks like that could work with a navigation filter parsing out the anchor portion of the URL. I'll give it a shot, anyway! As for the scroll-down-to-accordion part... guess I've got some more googling to do! :D Thanks! - John On Jan 23, 3:28 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You can use the navigation-option for that:http://docs.jquery.com/UI/Accordion/accordion Though you have to implement the scroll down to accordion yourself. Jörn On Thu, Jan 22, 2009 at 10:44 PM, bcbounders bcbound...@gmail.com wrote: Hi, This is probably a stupid question, but I've been scouring around trying to find an answer to no avail. Is is possible to have a hyperlink that links to the accordion on another page in such a way that it opens a specific accordion element? For instance, I have a page where I want to include an accordion where each accordion element is a different service offered by my company. On another page, I want to have a series of links, each one linking to a different element in the accordion, so that when the page is loaded, it scrolls down to that element and it is expanded. Is this possible? Thanks! - John- Hide quoted text - - Show quoted text -
[jQuery] Re: Recursion issue with nested lists.
You could try using a regular expression to exclude xml tags.. of course you would need something that gives more info than text().. I'm not sure what the function is for xml.. perhaps html() or contents() will work On Jan 23, 6:01 pm, Nicholas nbar...@gmail.com wrote: For a short summary on my issue, all that remains is the text() function returning the string of all the node values under the one i'm currently working with. This is by design, but I don't want it to do this and for the life of me cannot discover a way to exclude all the child nodes from text()!. The XML example: letter paragraphdata paragraphmore data paragrapheven more data /paragraph/paragraph/paragraph /letter I've designed a recursive function to move through the list until it reaches the end. However, the output looks like this (using the example above): 1. data more data even more data 2. more data even more data 3. even more data So, how can i get the text from only the node i'm currently working with instead of the text from the current and all child nodes? I've tried various filters and selectors but the results are always the same, either everything or nothing. Thanks, Nick
[jQuery] Re: Text Manipulation
Something like this should work: str = $(textinput).val(); $(textinput).val( str.substr(0,str.indexOf(@)) ); On Jan 23, 7:51 pm, whtthehecker hecker.r...@gmail.com wrote: Hi, I'm trying to create a sign up form where after the user inputs their email address when they click or tab down to the next field (username field) it auto-populates it with their email address but with the @x.xxx section stripped from it. i.e. if the user puts j...@johndoe.com into the email field when they tab to the username field it will auto-populate with john. I have achieved auto-populating the field with the email address but I'm not sure how to remove the @johndoe.com part. Thanks for any help you can provide!
[jQuery] Re: trying to get parent frame from mouse event
self.name On Jan 23, 8:29 pm, jquertil til...@gmail.com wrote: whats the best way to find the frame name of a click event? in FF I managed to do this: $('#'+e.view.name, top.document) but e.view.name is undefined in IE.
[jQuery] Re: Index of Parent TD
Here's an example using the index() function: head script src=jquery-1.2.6.js/script /head body table tr tda0../a/td tda1../a/td tda2../a/td tda id=linkID3../a/td td class=testa4../a/td /tr /table script test = $(td.test); alert( $(tr td).index( test ) ) test = $(td a#linkID).parent(); alert( $(tr td).index( test ) ) /script /body On Jan 22, 10:58 am, Aarron aarron.pain...@gmail.com wrote: Hi there, I have a link which sits inside a td within a tr within a table. What I would like to do is find out which td (which column) in the table this link is within - I need to find the column index. Once I have this I can then remove the column from the table. Any ideas on how to do this? I've tried the core index - but to no avail. Thanks!
[jQuery] Re: $.ajax timeout and trouble with Microsoft IIS 6
Perhaps the cache:false option is necessary? It adds a timestamp to the end of the querystring. The browser may be caching the request and therefore not showing potential errors. But then that wouldn't explain the descrepency between apache and iis. On Jan 22, 11:55 am, Stefano Corallo stefan...@gmail.com wrote: Hi all, i've a client side scrit that do a request to a server the server sleep for a 10 seconds and the respond, in the client side script i setup the timeout option at 1 second (1000) and i want to catch the error thrown (like explained all around the web :) ) a bit of code explain better: //client side $.ajax({ type: GET, url: some.php, data: name=Johnlocation=Boston, timeout: 1000 success: function(msg){ alert( Data Saved: + msg ); }, error:function(request, errorType, errorThrown){ alert(oppps ); } }); //backend some.php ? //simulate long task sleep(10); //sleep 10 seconds //send response echo some test data; ? Now the problem is that under apache all work good and i can see the alert message opp, but under the iis 6 no alert message popup and after 10 seconds the some test data came back to the client ... Have any one experience a problem like this? There something to set in iis ? Any help appreciated :D ps: sorry for my bad english :(
[jQuery] Re: Jquery tree menu Ul Li Ul
You can store information in a hidden input field (or fields) across postbacks (stores text only). Reference this field when the document gets loaded to either render your menu the way it needs to be rendered, or to adjust its state to reflect the state that was saved. This is how ASP.NET manages state using viewstate. On Jan 22, 9:35 am, mehstg1319 meh...@gmail.com wrote: Hi everybody Just looking for a couple of words of advice really as I haven't seen anything on the web that seems to fit what I am looking for. Basically...I have built a two tier menu system using Jquery to show and hide the second level when certain parts are clicked. I was wondering if it was possible to have it's state stay the same between pages on the site. I.e. have a second level stay open after a link is clicked and the page changes. At the moment, as soon as the page changes, the menu closes back up to default state, which is what would be expected. My code is as follows. $(document).ready(function() { //Hides Level 2 Menu Tree Elements $(div#leftnav ul li ul).hide(); // TREE MENU EVENT $(div#leftnav ul li a).click(function(event) { if ($(this).attr(href) == # ) { event.preventDefault(); if ($(this).next().is(ul) == true ) { var classCheck = $(this).attr(class); $(ul).filter(.active).hide(slow); $(ul).filter(.active).removeClass(); $(a).removeClass(active); if (classCheck != active) { $(this).addClass(active); $(this).next(ul).addClass(active); $(ul).filter(.active).show(slow); } } else { $(ul).filter(.active).hide(slow); $(ul).filter(.active).removeClass(); $(a).removeClass(active); } } }) }) Paul
[jQuery] Re: Split data grid
I think you can just do something like this to freeze the table header element: $(table th).css(position,relative); Not sure how well it works across browsers. I had issues with this on IE7 when I later tried to resize the overflow:scroll div. On Jan 22, 11:15 am, Mandrake mandrak...@gmail.com wrote: I've been using flexigrid and tablesorter for my data grid needs. However, i need a split datagrid function that these two do not have. You can check out what I mean by following this URL. http://dhtmlx.com/docs/products/dhtmlxGrid/samples/frozen_columns/pro... Basically I just need to pause the first few columns from moving while being able to sort the data. Anyone has any ideas? Thanks
[jQuery] Re: Unable To Traverse From an XML Ajax Response
Perhaps table is case-sensitive? On Jan 22, 3:53 pm, bittermonkey brakes...@gmail.com wrote: Hi, I need to know where I am doing wrong. The ALERT message in my jquery code doesn't seem to get hit when I put a breakpoint in firebug. The plan is to loop through all the TABLE Elements in the XML response and create a 3-column HTML table from its child nodes. Thanks in advance. This is my jQuery Code Where CategoriesList is a .NET dropdown control: - $(function(){ var selectid = # + '%= CategoriesList.ClientID %' $(selectid).change(function(){ $.ajax({ url: http://localhost/ws/JQService.asmx/ GetCategories, type: POST, data: categoryid= + category, dataType: xml, success: function(xml){ $(xml).find(table).each(function(){ alert(message); }); } }); }); }); This is the XML returned by my web service: --- ?xml version=1.0 encoding=utf-8? NewDataSet Table ProductID16/ProductID ProductNamePavlova/ProductName UnitPrice17.4500/UnitPrice /Table Table ProductID19/ProductID ProductNameTeatime Chocolate Biscuits/ProductName UnitPrice9.2000/UnitPrice /Table /NewDataSet
[jQuery] drag and drop fileupload with jquery
hi there, is a drag and drop fileupload with jquery possible? are there existing plugins? thanks in advance jay
[jQuery] Re: xml find element with this attribute value
I do sincerely apologize for my tone in my previous message. It's merely all too common for me to spend hours researching something I know should be fairly simple only to find scores of pages full of posts telling me how not to do it but not taking the time to tell me how to do it right. Thank you for taking the time to respond with some example syntax. It's a HUGE help! On Wed, Dec 10, 2008 at 1:11 PM, Karl Swedberg [EMAIL PROTECTED]wrote: Sheesh, James. I was actually trying to help by offering both a correction and a link to John Resig's plugin (which *is* necessary if you want to use the xpath syntax). Anyway, here is how you can select elements that have a particular attribute value: $('sample[name=a]') http://docs.jquery.com/Selectors/element#element http://docs.jquery.com/Selectors/attributeEquals#attributevalue Responding to my response with something a little less snotty would have been nice. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 9, 2008, at 5:21 PM, James Darnell wrote: So you've essentially told us that the syntax provided above is no longer usable without providing us with an alternative that is... Responding with something we can use (without having to install an unnecessary plugin) would have been beneficial. On Oct 25, 9:42 am, Karl Swedberg [EMAIL PROTECTED] wrote: On Oct 24, 2008, at 7:09 AM, Robert Koberg wrote: On Oct 24, 2008, at 2:35 AM, akel wrote: i've been reading a lot and still does not find any solution to my query. please find the details below. list sample name=a id=1/ sample name=b id=2/ /list in jquery how can i automatically find the element sample with attribute name equals to a without looping entirely the xml jQuery supports a kind of XPath syntax, so: $(/list/[EMAIL PROTECTED]'a']) The / is no longer available and the @ is deprecated. There is a basic xpath plugin available if you still want to use these selectors: http://plugins.jquery.com/project/xpath --Karl -- Please visit my online art gallery: http://www.ethereal-imagery.com
[jQuery] Re: has anyone come across a plugin like this ?
Thought it was pretty cool, so I threw my own plug in together in a little over an hour to mimic what he did there. It's pretty simple but should work in ie6/7,ff,safari. You can set a few different options, and I'm sure this could be expanded upon to give it a lot more power. Anyway, here you go. style type=text/css ul { list-style: none; } ul li { margin-right: 5px; display: block; float: left; overflow: hidden; font-size: 12px; height: 20px; } ul li a { float: left; display: block; position: relative; overflow: hidden; height: 20px; } /style script type=text/javascript $(function(){ $('#breadcrumb').jCrumb({}); }); (function($){ $.fn.jCrumb = function(options) { var defaults = { listLimit : 650, itemMin : 15, expandTime : 800, collapseTime : 800 }; var opts = $.extend(defaults, options); return this.each(function(){ var obj = $(this); if(obj.width()opts.listLimit) { var children = $('li', obj); children.each(function(i){ if(i0 i(children.length-1)) { var el = $(this); el.data('width', el.width()) .children('a').width(el.data('width')).wrap('span /') .parent().css({display: 'block', position: 'relative', overflow: 'hidden', width: opts.itemMin+'px'}) .hover( function() { $(this).stop().animate({ width: el.data ('width') },{ duration: opts.expandTime, easing: swing, queue: false }); }, function() { $(this).stop().animate({ width: opts.itemMin +'px' }, { duration: opts.collapseTime, easing: swing, queue: false }); } ); } }); } }); } })(jQuery); /script /head body ul id=breadcrumb lia href=#Home/a/li lia href=#Short/a/li lia href=#Random Breadcrumb Super Super Super Super Long/a/ li lia href=#Random Breadcrumb Blach/a/li lia href=#Random Breadcrumb Length Long/a/li lia href=#Random/a/li /ul /body On Nov 13, 3:41 pm, George [EMAIL PROTECTED] wrote: Count me in for the Plug-In request :) It's pretty cool and the whole site is done very well, I put it in to my Favorites so later I could revisit and 'steal' some design ideas. PS: I am a .NET developer myself and so far find it to be more superior (if I can say that) to Perl. The problem you might have is only because of lack of experience with .NET (no offence). The more you program on .NET the more you going to like it. I am talking from experience here. I was bitching and complaining couple years ago... now I would refuse to work if it's not on .NET There is nothing in .NET that prevents you from doing things like they done in Perl. So do not be down on it :) George.
[jQuery] Re: How to pass a jQuery object to PHP as an array
How can I pass this object as an hidden form field back to my PHP controller as an array? What would php do with a javascript object if you passed it? Perhaps you should be passing some property of the object instead?
[jQuery] Re: Get All Values/Text and Add a ;
On Nov 1, 8:54 am, jetm [EMAIL PROTECTED] wrote: In multiple select: select id=select1 name=select1 multiple=multiple optionFlowers/option optionShrubs/option optionTrees/option /select I want with a output like this: Flowers2; Shrubs2; Trees2; I using this var str = ; $(#select2).each(function(){ str += $(this).text() + ;; $(div).text(str); }); for get all values/text from option and each one add ; But the problems is in the output show me this: Flowers2 Shrubs2 Tree Maybe you want something like this instead? var str = ; $(#select2).each(function(){ str += $(this).text() + ;; }); $(div).text(str);
[jQuery] Re: Get All Values/Text and Add a ;
You're using each() to extract the selected options. That will not work as written. You need to select the child nodes that are option's, See the selector below. You also need to move the result write after the end of the loop. html head script src=jquery-1.2.6.min.js type=text/javascript/script /head body select id=select1 name=select1 multiple=multiple optionFlowers/option optionShrubs/option optionTrees/option /select p/ /body script type=text/javascript !-- $( function() { var str = ; $(#select1option).each(function(){ str += $(this).val() + ;; }); $(p).text(str); } ); //-- /script /html
[jQuery] closing tag bug in jQuery 1.2.6?
Has someone else already posted this bug? The following code shows jquery failing to detect the termination of a tag. Load the page and click on the word login. The selector should find the empty div and display the html content (nothing). Instead shows the span closing tag and the javascript that follows. html head titlejQuery bug test Page/title script src=script/jquery-1.2.6.min.js type=text/javascript/ script /head body style=background-color:black span id=Login style=position:absolute; top:20px; left:5%; width: 90%; z-index:12; span id=LoginToggle style=float:right; color=green;Login/span div class=popupContent style=float:right; / /span script type=text/javascript !-- $( function() { $(#LoginToggle).click( function(){ alert( $ ( '#Logindiv.popupContent' ).html() ); }); } ); //-- /script /body /html If you change the div closing it works correctly. Change this: div class=popupContent style=float:right; / To this: div class=popupContent style=float:right; /div Does the same in IE7 and FF3