[jQuery] Re: async validation
Brian J. Cardiff schrieb: that's an approach, yes. but also on submit you should ensure validations match actual values. So maybe store also last value validated, and there a cron could be implemented pretty easily. That checking, if the previous validated value is the current value, is already part of the remote method. The only detail thats missing is the ability to run the remote validation only on blur, not on keypress, while other validations run on keypress. Currently thats rather difficult to achieve without modifying the plugin, but for now just displaying keypress validation should get you pretty close already. All the other details mentioned in this thread are taken care of in the remote method. Jörn
[jQuery] Re: Validator | does not submit ajax function in Firefox
AlexGrande.com schrieb: In IE it works fine but in FF I have to click again to make it go. Here is the code: ajax function- [...] Any suggestions or hacks? You are binding the submit handler after the form validation succeded. Instead you should run the handler directly, eg. function ajaxForm() { $.ajax({ ... }); } Jörn
[jQuery] Re: Only first cluetip on a page works
Thanks Karl. That did the trick! :) On Mar 28, 9:03 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Brian, Yes, an ID absolutely must be unique for a given document if you want any DOM operations to run predictably. Might I suggest using a class name instead? Instead of this ... $('#glossary').cluetip({ try this ... $('a.glossary').cluetip({ And instead of this ... a id=glossary href=# title=Social Security|definition hereSocial Security/a a id=glossary href=# title=Benefit|definition hereBenefit/a a id=glossary href=# title=Will|definition hereWill/a etc. try this ... a class=glossary href=# title=Social Security|definition hereSocial Security/a a class =glossary href=# title=Benefit|definition hereBenefit/ a a class =glossary href=# title=Will|definition hereWill/a etc. Hope that helps --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Mar 28, 2008, at 6:11 PM, ooper wrote: I'm using cluetip to show glossary definitions on a page that has an article on it. I can only get the first cluetip to work correctly. Not sure what I am doing wrong. Here is my script: script type=text/javascript $(document).ready(function() { $('#glossary').cluetip({ splitTitle: '|', // use the invoking element's title attribute to populate the clueTip... // ...and split the contents into separate divs where there is a | showTitle: true, arrows: true, dropShadow: true, positionBy: 'mouse' }); }); /script And then I have a bunch of anchor tags throughout the html page that look something like this: a id=glossary href=# title=Social Security|definition hereSocial Security/a a id=glossary href=# title=Benefit|definition hereBenefit/a a id=glossary href=# title=Will|definition hereWill/a etc. Ideas? Does the id or the href have to be unique for each one? TIA, Brian Barnett
[jQuery] Re: JQuery Hello world not working
Thanks all. I think it is the mistake of the author who wrote this example on the JQuery help page. I just copied and pasted the code, but didnt realize that I had to add an achor tag. Thanks to everyone for your replies On Mar 5, 9:24 pm, ajpiano [EMAIL PROTECTED] wrote: also, i'm not saying it's wrong or bad sidecomment but i have literally never ever seen anyone have line breaks in the middle of their closing tags... / sidecomment On Mar 5, 10:33 am, J Moore [EMAIL PROTECTED] wrote: wow, the lag on this list is brutal. is there any way of reducing it, so people don't spend time responding to already-answered questions? On Mar 5, 9:34 am, J Moore [EMAIL PROTECTED] wrote: actually, your code doesn't display a link. it sets up an action when the link is clicked. You're missing: a href=#do something/a There might be other problems too if you aren't even seeing the alert message. Download firefox and firebug. IE isn't much help for developing javascript. -j On Mar 5, 5:16 am, pradeep_tp [EMAIL PROTECTED] wrote: Hi All, I am new to JQuery. I did the following to get started with JQuery. 1) Downloaded JQuery Uncompressed version. Renamed JQuery.1.2.3.js to JQuery.js (I do not know whether this is correct! ) 2) I followed the tutorial for Hello world and typed the following code into an HTML file html head script type=text/javascript src=jquery.js /script script type=text/ javascript alert('here'); $(document).ready(function() { $(a).click(function() { alert(Hello world!); }); }); / script / head body / body /html After opening this HTML file in IE 7.9, I find nothing on the page, not even any javascript error. The code is supposed to display a link, but I do not find any link on the page. Can anyone help me here. - pradeep- Hide quoted text - - Show quoted text -
[jQuery] Re: clueTip click and drag?
Hi Karl, Thanks for more good advice. I moved the new code into onShow. I had to pass opts as an additional argument to onShow so I could check to see if 'draggable' was set, but after that it worked like a charm! happily dragging clueTips, az On Mar 28, 8:30 am, Karl Swedberg [EMAIL PROTECTED] wrote: that's really cool. thanks for sharing your success! If you're adding those 2 lines right after the opts.onShow... you might be able to simply use the onShow option instead. It's there as an extension point, so this is just the sort of thing that onShow was intended for. btw, just to give credit where it's due, I believe it was Dan G. Switzer who wrote the onShow stuff for clueTip. Thanks again, Dan! --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Mar 28, 2008, at 4:55 AM, az wrote: Hi Karl, Thanks for the quick reply and for pointing me in such a fruitful direction. Based on UI Dialog, here's what I did: 1. I included ui.mouse.js and ui.draggable.js 2. I added a 'draggable' option to clueTip. 3. Immediately after opts.onShow($cluetip, $cluetipInner); [not sure if this is the best place] I added: --- if (opts.draggable) { $cluetip.draggable({ handle: '#cluetip-title' }); $('#cluetip-title').css('cursor', 'move'); } --- It was so easy that it must be wrong, but it works! I don't know if this will benefit anyone else, but it definitely makes my application a little more user friendly. The draggable option only makes sense if sticky is turned on. thanks again, az On Mar 27, 8:12 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Hi az, I'm glad you like the plugin! Thanks for mentioning that. I imagine the additional feature could be accomplished, but perhaps it's not the right plugin for the job. Have you taken a look at the UI Dialog?http://docs.jquery.com/UI/Dialog That might be closer to what you're after there. If you want to have a go at making clueTip work with the drag, you can probably get some good ieas from Dialog or Draggables (both part of UI) or jqModal. --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Mar 27, 2008, at 8:28 PM, az wrote: Hello, I think the clueTip plugin is fantastic and I'm using it heavily in one of my current projects. My clueTips are sticky so the user can interact with them. In one case the clueTip contains a small feedback form. But sometimes the clueTip partially covers the content that the user is giving feedback on! I'd love for the user to be able to click on the header and drag the clueTip to a more convenient location. Is the possible with the current clueTip code? If not, would it be difficult to add this? I'd be willing to take a crack at the code with a little guidance. thanks! az
[jQuery] Re: Calling a jQuery function from within an ajax-loaded div
Lets backtrack for a moment. I have a similar situation, but I don't use that particular plugin (its an older setup, recently modified with jQ). When you load the new div with your ajax call, add the sort to your success: function. For example, in your test case: $.ajax({ type: GET, contentType: html, url: url, async: true, success: function (conf) { $(#myDiv).html( conf ); $('#user_list th').hover(function () { alert(test test); }); } }); Kris On Mar 28, 10:48 pm, echobase [EMAIL PROTECTED] wrote: I think I may be getting closer and maybe getScript() is the answer. But I'm still not getting a some things Where and how would I use the getScript() function? I've looked for relevant examples but I can't find any that remotely fit my situation. If I have a page with this ajax function and empty div: $.ajax({ type: GET, contentType: html, url: url, async: true, success: function (conf) { $(#users_list_view).html( conf );}}); div id=users_list_view /div ..and the url I'm loading contains this table to fill that div: table id=users_list class=sortable thead tr th class=sortableLast Name/td th class=sortableFirst Name/td th class=sortableSales/td /tr /thead tbody . /tbody /table .then where exactly do I put the jQuery code I described earlier that handles events from this loaded table? The jQuery code is supposed to put an alert on the page when you hover over one of the table headers, but that's just a test. What I really want to do is use Tablesorter to make the columns sortable when the headers are clicked. Thanks very much for your help. Again, I think I may be close.. On Mar 27, 5:38 pm, jquertil [EMAIL PROTECTED] wrote: you want to ook into the getScript() function. the SCRIPT tags arent interpreted by jquery, so you have to load the script separately. On Mar 27, 4:10 pm, echobase [EMAIL PROTECTED] wrote: I'm loading a div using this .ajax function: $.ajax({ type: GET, contentType: html, url: url, async: true, success: function (conf) { $(#myDiv).html( conf );} }); div id=myDiv /div In that url that's being loaded I have this jQuery function: script type=text/javascript $(document).ready(function() { $('#user_list th').hover( function () { alert(test test); }); }); /script table id=user_list /table But this simple function doesn't work. Why not? If I type the url for this page directly then the function does work. How do you get a jQuery function to work from a div loaded by ajax? Thanks.- Hide quoted text - - Show quoted text -
[jQuery] Re: Strange bold look after a show in IE6
Or, as Snef mentioned, you can define a background color in your stylesheet for the element that is being faded. Setting the background color will only fix the issue in IE6 and only for certain font sizes. IE7 will still display the text poorly if cleartype is enabled. A more general fix for using jQuery's fade functions can be found here: http://malsup.com/jquery/fadetest.html Mike
[jQuery] Re: Plugin pattern
You can't.. or you'll lose the `this`. Unless you do: $(seletor).project().ajax().remote(); and each method returns the `this`. Cheers -- Ariel Flesler http://flesler.blogspot.com/ On Mar 28, 11:23 am, alexanmtz [EMAIL PROTECTED] wrote: Hi everyone, Im working in a big project of ajax and I would like to use a plugin pattern thats not working in pratice... All javascript in the project I would like to transform in a jQuery plugin. But to achieve this I need to separate in categories in libraries for this site Im working So, I wanna to make this: $(seletor).project.ajax.remote(); $(seletor).helpers.options(); But when Im creating a plugin like this: $.fn.project.ajax.remote = function() { //code } Its not working... Using extend I reach it, but extending methods of jQuery objects I cant do that. I need this because I create a ajax library just for the site and a lot of thing, so we need this pattern... How I can accomplish this thanks everyone...
[jQuery] Re: dynamically loading javascript files (getScript() behavior)
Hi, Still, I've been using another approach that seems to work fine (at least) in FF and IE. Insted of getting the file and evaluating it, I just add a new SCRIPT element to the HEAD of the document with the specified URL. There are Safari Versions that don't load scripts that way. For nowI would not expectthat to be a big problem, because I guess Safari users tend to upgrade regularily. The main difference with this is that I can check if that script was already loaded (maybe by another component) and thus avoid loading it twice. Yes. There are more powerfull package management systems for JavaScript that can even handle dependencies between multiple packages without loading one package twice. See as an example jsPax.org. I am pretty sure that there is a good reason why to use eval instead of my approach, but I just wanted to know why. The reason is Safari. Christof
[jQuery] Re: Only first cluetip on a page works
Excellent. Glad to hear it. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 29, 2008, at 1:24 AM, ooper wrote: Thanks Karl. That did the trick! :) On Mar 28, 9:03 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Hi Brian, Yes, an ID absolutely must be unique for a given document if you want any DOM operations to run predictably. Might I suggest using a class name instead? Instead of this ... $('#glossary').cluetip({ try this ... $('a.glossary').cluetip({ And instead of this ... a id=glossary href=# title=Social Security|definition hereSocial Security/a a id=glossary href=# title=Benefit|definition hereBenefit/ a a id=glossary href=# title=Will|definition hereWill/a etc. try this ... a class=glossary href=# title=Social Security|definition hereSocial Security/a a class =glossary href=# title=Benefit|definition hereBenefit/ a a class =glossary href=# title=Will|definition hereWill/a etc. Hope that helps --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Mar 28, 2008, at 6:11 PM, ooper wrote: I'm using cluetip to show glossary definitions on a page that has an article on it. I can only get the first cluetip to work correctly. Not sure what I am doing wrong. Here is my script: script type=text/javascript $(document).ready(function() { $('#glossary').cluetip({ splitTitle: '|', // use the invoking element's title attribute to populate the clueTip... // ...and split the contents into separate divs where there is a | showTitle: true, arrows: true, dropShadow: true, positionBy: 'mouse' }); }); /script And then I have a bunch of anchor tags throughout the html page that look something like this: a id=glossary href=# title=Social Security|definition hereSocial Security/a a id=glossary href=# title=Benefit|definition hereBenefit/ a a id=glossary href=# title=Will|definition hereWill/a etc. Ideas? Does the id or the href have to be unique for each one? TIA, Brian Barnett
[jQuery] Re: JQuery Hello world not working
--Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 29, 2008, at 6:19 AM, pradeep_tp wrote: Thanks all. I think it is the mistake of the author who wrote this example on the JQuery help page. I just copied and pasted the code, but didnt realize that I had to add an achor tag. Well, I don't think it is a mistake so much as an assumption that a page has to have a link on it if you're going to click on that link. In any case, I added the following to that example (it's a wiki, after all, so we're all able to improve it): Of course, you'll also need to add a link within the body of your HTML file: body a href=http://jquery.com;jQuery/a /body I hope that helps prevent further confusion. Cheers, Karl Thanks to everyone for your replies On Mar 5, 9:24 pm, ajpiano [EMAIL PROTECTED] wrote: also, i'm not saying it's wrong or bad sidecomment but i have literally never ever seen anyone have line breaks in the middle of their closing tags... / sidecomment On Mar 5, 10:33 am, J Moore [EMAIL PROTECTED] wrote: wow, the lag on this list is brutal. is there any way of reducing it, so people don't spend time responding to already-answered questions? On Mar 5, 9:34 am, J Moore [EMAIL PROTECTED] wrote: actually, your code doesn't display a link. it sets up an action when the link is clicked. You're missing: a href=#do something/a There might be other problems too if you aren't even seeing the alert message. Download firefox and firebug. IE isn't much help for developing javascript. -j On Mar 5, 5:16 am, pradeep_tp [EMAIL PROTECTED] wrote: Hi All, I am new to JQuery. I did the following to get started with JQuery. 1) Downloaded JQuery Uncompressed version. Renamed JQuery. 1.2.3.js to JQuery.js (I do not know whether this is correct! ) 2) I followed the tutorial for Hello world and typed the following code into an HTML file html head script type=text/javascript src=jquery.js /script script type=text/ javascript alert('here'); $(document).ready(function() { $(a).click(function() { alert(Hello world!); }); }); / script / head body / body /html After opening this HTML file in IE 7.9, I find nothing on the page, not even any javascript error. The code is supposed to display a link, but I do not find any link on the page. Can anyone help me here. - pradeep- Hide quoted text - - Show quoted text -
[jQuery] Re: Strange bold look after a show in IE6
Absolutely. Thanks for the clarification (no pun intended), Mike. It seemed the OP was referring specifically to IE6, but a more robust solution is definitely called for. Cheers, --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 29, 2008, at 8:17 AM, Mike Alsup wrote: Or, as Snef mentioned, you can define a background color in your stylesheet for the element that is being faded. Setting the background color will only fix the issue in IE6 and only for certain font sizes. IE7 will still display the text poorly if cleartype is enabled. A more general fix for using jQuery's fade functions can be found here: http://malsup.com/jquery/fadetest.html Mike
[jQuery] Re: Strange bold look after a show in IE6
Thanks guys for extensive answers Setting a background partially solved the issue. I'll investigate more on this back at work on Monday. It seems that YUI is slightly better on this than jQuery. http://icant.co.uk/sandbox/msieopacityissue/ Mike, I will test your plugin, once I get back to a buggy LCD screen. Is it doing the same as YUI ? Have you submitted it as a patch for jQuery ? thanks -Olivier Mike Alsup wrote: Or, as Snef mentioned, you can define a background color in your stylesheet for the element that is being faded. Setting the background color will only fix the issue in IE6 and only for certain font sizes. IE7 will still display the text poorly if cleartype is enabled. A more general fix for using jQuery's fade functions can be found here: http://malsup.com/jquery/fadetest.html Mike
[jQuery] Re: bind() and thousands of td elements - inline or extrnal?
I think in this case it is better to use event delegation, e.g. set up a single handler on the parent table element and handle the click here. You can get to the clicked cell via e.target. --Klaus On Mar 28, 5:25 pm, Leeoniya [EMAIL PROTECTED] wrote: i need to bind a click function to several thousand table cells. would making an external function be better than specifying an anonymous one inline?...i'm afraid that with the inline version it would make as many function instances as there are table cells...correct me if i'm wrong. thanks, Leon -- View this message in context:http://www.nabble.com/bind%28%29-and-thousands-of-%3Ctd%3E-elements--... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Strange bold look after a show in IE6
Mike, I will test your plugin, once I get back to a buggy LCD screen. Is it doing the same as YUI ? What is YUI doing?
[jQuery] Re: how remove the attributes added by jquery : jQuery1206707292281
The code with a loop on all elements works fine. In fact my problem is the following : I have 2 trees of html : #block1 and #block2 I want to know if the 2 blocks are the same (same node names , same attributes, same attribute values, ...). The only way I found, is to compare the $('#block1').html() with $ ('#block2').html() . It isn't perfect but it is better than nothing. It works fine if the attributes are in the same orders ... Concerning JQueryxx attributes, it should be better to provide a JQuery function to clean up all the html elements that have been tagged using the jquery cache. For each element in the jquery cache, removeData on it. It would be the only efficient way even with large html trees. JQuery library is very clean in term of script dependancy, but concerning the html code it could be cleaner. At least it could give a way to make the html clean after jquery calls . On 29 mar, 05:29, Karl Rudd [EMAIL PROTECTED] wrote: One of the core team might be able to tell you why the attributes are added for IE, it's probably something to do with some fix for a bug/feature of IE. What are you trying do when you compare the HTML? If it's just a small block of code (say contained in a div with id=block) you could do the replacement with a fair amount of efficiency: $('#block *').each(function() { $.removeData(this) }); If it's a larger block of code then perhaps you could rethink what or how you're comparing. Karl Rudd On Sat, Mar 29, 2008 at 9:15 AM, domi01 [EMAIL PROTECTED] wrote: The .removeData(elem) works if you have the HTML element with the jQueryxxx attribute. In my case I don't know those elements . I could make a loop on all the elements and calls the function in order to remove those tags. This process won't be efficient. In my case, the problem occurs only with IE. With Firefox the attributes jQueryxx are not added.
[jQuery] Functions from xml parsed document
Hi one and all, I'm loading a page from an xml file, no problems works fine; below is what is output to give a better understand of what im trying to do... div class=product \img src=blah1.jpg / div class thumbsimg1 /img2 //div The plan is, when someone clicks on a thumbnail, it get displayed in the main image. If i hard code some values in the html (rather than parse from xml) thumbnail / display function works, the source updates, all good. However, when I parse from the xml file, clicking on the thumbnails does nothing. //Parse xml file $(document).ready(function() { $.get('bedroom.xml', function(data) { $('#main').empty(); var $html; $(data).find('product').each(function() { var $product = $(this); $html = 'div class=product'; var $id = $product.find('id').text(); var $name = $product.find('name').text(); $html += 'h2' + $name + '/h2br /br /'; $html += '\img src='+ $product.find('source').text() + ' /'; var $thumbs = $product.find('thumbnails'); if($thumbs.length) { $html += 'div class=thumbs'; $thumbs.find('thumb').each(function() { $html += '\img src=' + $(this).text() + ' /'; }); $html += '/div'; } $html += '' + $product.find('description').text(); $html += 'br /br /'; $html += 'Prices from: pound;' + $product.find('price').text(); $html += 'br /br /'; $html += ' \img style=border:none src=images/add.jpg width=100px height=20px / ' $html += '/divdiv class=spacer/div'; }); $('#main').html($html); $('.product').dropShadow(); }); }); //Thumbnail swap $(document).ready(function() { $('.thumbs img').click(function() { var scr = $(this).attr('src').replace(thumbs/,); $(this).parents('.product').children('img').attr('src',scr); }); }); Can someone please help me figure out why its not working? (ignore the \img in the code, ive only put the slashs in to delimit the html for this message) Thanks Rich -- View this message in context: http://www.nabble.com/Functions-from-xml-parsed-document-tp16369996s27240p16369996.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Uploader 0.9 beta
Hi Gilles! Just wanted to check what the status of the plugin is? cheers, Kai On Mar 2, 8:52 pm, Gilles (Webunity) [EMAIL PROTECTED] wrote: Plugin will be ready in 2 to 3 weeks, have some seminars i have to attend, sorry. --- Gilles
[jQuery] Drop Down Menus and Applets
I've been trying to add a main horizontal nav menu to my web app, but can't figure out how to get the drop down sub menus to show over top of applets. I have tried the superfish plugin with bgiframe plugin exactly how it is shown on the superfish home page. I have also tried the jdMenu plugin with bgiframe plugin. Although in that case I'm not sure if I applied the bgiframe correctly because I couldn't find any docs on how to do so. I've tried the YUI menu, which has an iframe flag. If I set that to true, then the sub menus show over top of the applets. Even though I can get the YUI menu to work, I'd really like to stick with all jquery plugins and get either superfish or jdMenu working. Here is my javascript code for the superfish menu: $(document).ready( function() { $(ul.nav) .superfish({ animation : { opacity:show, height:show } }) .find(li:has(ul)) .mouseover(function(){ $(ul, this).bgIframe({opacity:false}); }) .find(a) .focus(function(){ $(ul, $(.navli:has(ul))).bgIframe({opacity:false}); }); }); I'm using the default superfish.css stylesheet too. I'm experiencing this problem on IE 6/7 and Firefox 2. I wish I could just rip these applets off the screen and throw them in the trash. I'm constantly working around them. So if anyone can help me get my superfish drop down nav menu working with these trash applets I'd really appreciate it. Thanks, Bryan
[jQuery] Help with simple toggle not working in IE
Hi am brand new to the wonderful world of JQuery; this shouldnt be too difficult: Why isnt the client login drop-down toggle working in Explorer? www.wdmadvertising.com.au/intervest/index.html Any help would be greatly appreciated :)
[jQuery] clearTimeOut(this.iTimer) is not defined
Hi! I'm currently taking my first steps again my own first plugin. As you probably already figured out, it's not working. It is a small plugin that is supposed to animate a menu or any other element so that it stays visible to the user, even when the user scrolls down the page. Before I can start to animate, I need to make sure that the scrolling has stopped, and this is where the (first?) problem occurs. Before I call clearTimeOut() I check to see if it's undefined to escape any errors, but the funny thing is that is still executes the clearTimeOut(). Here's the function: if ( this.iTimer != undefined || this.iTimer != 'undefined' ) { try { clearTimeOut(this.iTimer); } catch (exception) { alert(exception); } } I have set up two different test pages for you to inspect, the first one (http://www.kpsdiscjockey.se/jquery/jquery.test.html) is built without the code as a plugin, the second one (http:// www.kpsdiscjockey.se/jquery/jquery.test2.html) is build with the code inside a plugin. So the ultimate question is: What do I do wrong? Thank you! Carl-Fredrik PS. As this is my first plugin, I'm happy to receive comments and suggestions for improvements on the code as a whole.
[jQuery] array problems
Hello, I have a problem with arrays. I am getting data from xml and trying to get data to arrays. Here is my code: === var monster = [[[]]]; ... $(this).find('monsters').each(function(id2){ monster[pid][id2]['db_id'] = $(this).find('db_id').text(); }); ... === When I am alerting the variable it alerts only the first value and then stops and in firebug I see this error: monster[pid][id2] has no properties [Break on this error] monster[pid][id2]['db_id'] = $ (this).find('db_id').text(); Maybe I have wrongly defined monster variable?
[jQuery] Image bounce
A wile back I received a email demonstrating several different image displays. One that I need today but cant find is where the image dropped down from the top and bounced for a few seconds. If any one has a link to the I would be very appreciative. Thanks Ram
[jQuery] Re: JQuery timer with reset option
UPDATE: I had set the mousemove event to bind to window: $(document).ready(function() { startTimer(); $(window).bind(mousemove, function() { resetTimer(); }); }); That works fine in FF, but IE had some trouble with it. Better to set that to document $(document).ready(function() { startTimer(); $(document).bind(mousemove, function() { resetTimer(); }); }); So the full updated script: My code: - /** * When the document is ready, start the timer (startTimer();) and * bind all mouse movement to resetTimer(); */ $(document).ready(function() { startTimer(); $(document).bind(mousemove, function() { resetTimer(); }); }); /** * Some vital global variables for the timer */ var timerId = 0; var counterId = 0; /** * Start the timer */ function startTimer() { alertTimerId= setTimeout('refreshPage()', 15000); updateCounter('15'); } /** * Reset the Timer */ function resetTimer() { clearTimeout ( alertTimerId ); clearTimeout ( counterId ); startTimer(); } /** * Refresh the Page */ function refreshPage() { var sURL = unescape(window.location.pathname); window.location.replace( sURL ); } /** * Update the on-page Counter */ function updateCounter(count) { count = count - 1; $('#timer').html(count); counterId = setTimeout('updateCounter(\''+count +'\')', 1000); }
[jQuery] Re: Drop Down Menus and Applets
Hi Bryan, Are you referring to Flash objects? If so, I just replied to someone yesterday regarding the same issue. Here is the relevant part: If you're using swfObject, you can just use: so.addParam(wmode, transparent); for embed, you add the attribute: wmode=transparent for object, you do param name=wmode value=transparent / hope that helps. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 29, 2008, at 9:34 AM, Bryan Wilson wrote: I've been trying to add a main horizontal nav menu to my web app, but can't figure out how to get the drop down sub menus to show over top of applets. I have tried the superfish plugin with bgiframe plugin exactly how it is shown on the superfish home page. I have also tried the jdMenu plugin with bgiframe plugin. Although in that case I'm not sure if I applied the bgiframe correctly because I couldn't find any docs on how to do so. I've tried the YUI menu, which has an iframe flag. If I set that to true, then the sub menus show over top of the applets. Even though I can get the YUI menu to work, I'd really like to stick with all jquery plugins and get either superfish or jdMenu working. Here is my javascript code for the superfish menu: $(document).ready( function() { $(ul.nav) .superfish({ animation : { opacity:show, height:show } }) .find(li:has(ul)) .mouseover(function(){ $(ul, this).bgIframe({opacity:false}); }) .find(a) .focus(function(){ $(ul, $(.navli:has(ul))).bgIframe({opacity:false}); }); }); I'm using the default superfish.css stylesheet too. I'm experiencing this problem on IE 6/7 and Firefox 2. I wish I could just rip these applets off the screen and throw them in the trash. I'm constantly working around them. So if anyone can help me get my superfish drop down nav menu working with these trash applets I'd really appreciate it. Thanks, Bryan
[jQuery] Re: how to get innerHTML from an external bind()?
replace $(elem).html by $(elem).html()
[jQuery] Off Topic: Earth hour
Anyone participating? http://www3.earthhourus.org/ I will. It's for a good cause. It's for our home, earth.
[jQuery] Modals - What's everyone using?
I want to build a modal window with a form in it but don't want to use the blacked out effect similar to many lightbox implementations. What's everyone using for this type of functionality? Rey...
[jQuery] Re: how remove the attributes added by jquery : jQuery1206707292281
Hmmm so how are the changes to either block being made? Is it via user interaction? Could you track the changes when they are made, that way you wouldn't need to compare the entire block each time. You could also try Jeffery's method and filter the HTML through a regular expression before comparison: var html1 = $( '#block1' ).html().replace( / jQuery\d+/,'' ); Karl Rudd On Sat, Mar 29, 2008 at 9:58 PM, domi01 [EMAIL PROTECTED] wrote: The code with a loop on all elements works fine. In fact my problem is the following : I have 2 trees of html : #block1 and #block2 I want to know if the 2 blocks are the same (same node names , same attributes, same attribute values, ...). The only way I found, is to compare the $('#block1').html() with $ ('#block2').html() . It isn't perfect but it is better than nothing. It works fine if the attributes are in the same orders ... Concerning JQueryxx attributes, it should be better to provide a JQuery function to clean up all the html elements that have been tagged using the jquery cache. For each element in the jquery cache, removeData on it. It would be the only efficient way even with large html trees. JQuery library is very clean in term of script dependancy, but concerning the html code it could be cleaner. At least it could give a way to make the html clean after jquery calls . On 29 mar, 05:29, Karl Rudd [EMAIL PROTECTED] wrote: One of the core team might be able to tell you why the attributes are added for IE, it's probably something to do with some fix for a bug/feature of IE. What are you trying do when you compare the HTML? If it's just a small block of code (say contained in a div with id=block) you could do the replacement with a fair amount of efficiency: $('#block *').each(function() { $.removeData(this) }); If it's a larger block of code then perhaps you could rethink what or how you're comparing. Karl Rudd On Sat, Mar 29, 2008 at 9:15 AM, domi01 [EMAIL PROTECTED] wrote: The .removeData(elem) works if you have the HTML element with the jQueryxxx attribute. In my case I don't know those elements . I could make a loop on all the elements and calls the function in order to remove those tags. This process won't be efficient. In my case, the problem occurs only with IE. With Firefox the attributes jQueryxx are not added.
[jQuery] Re: clearTimeOut(this.iTimer) is not defined
It's already fixed in the code you show on the test. In most cases, Google gives you faster responses than this group does: http://www.google.com/search?q=cleartimeout -- Ariel Flesler http://flesler.blogspot.com On 29 mar, 14:43, Cronlajoon [EMAIL PROTECTED] wrote: Hi! I'm currently taking my first steps again my own first plugin. As you probably already figured out, it's not working. It is a small plugin that is supposed to animate a menu or any other element so that it stays visible to the user, even when the user scrolls down the page. Before I can start to animate, I need to make sure that the scrolling has stopped, and this is where the (first?) problem occurs. Before I call clearTimeOut() I check to see if it's undefined to escape any errors, but the funny thing is that is still executes the clearTimeOut(). Here's the function: if ( this.iTimer != undefined || this.iTimer != 'undefined' ) { try { clearTimeOut(this.iTimer); } catch (exception) { alert(exception); } } I have set up two different test pages for you to inspect, the first one (http://www.kpsdiscjockey.se/jquery/jquery.test.html) is built without the code as a plugin, the second one (http://www.kpsdiscjockey.se/jquery/jquery.test2.html) is build with the code inside a plugin. So the ultimate question is: What do I do wrong? Thank you! Carl-Fredrik PS. As this is my first plugin, I'm happy to receive comments and suggestions for improvements on the code as a whole.