[jQuery] Re: non-DOM usage? (Rhino in the wild)
Hi Waseem, What Owen is talking about is using jQuery as a pure javascript (as a language) tool, so there is no page to worry about. Rhino is a javascript interpreter/compiler. Think of jQuery for C++, you get the picture :) cheers, - ricardo On 17 abr, 22:43, waseem sabjee waseemsab...@gmail.com wrote: would doing that not cause your site to lose and w3c xhtml validation ? or I am over thinking On Sat, Apr 18, 2009 at 3:39 AM, Ricardo ricardob...@gmail.com wrote: Most features of jQuery are DOM related, so what part of it exactly would you like to use? jQuery's source is divided in modules, guess you could take only what you need from each: http://jqueryjs.googlecode.com/svn/trunk/jquery/src/ cheers, - ricardo On Apr 17, 4:02 pm, Owen Densmore o...@backspaces.net wrote: Hi folks. Apparently jQuery can not be used outside the browser .. or at least without a DOM: Rhino 1.7 release 2 2009 03 22 js load('/Users/owen/local/jquery-1.3.2.js'); js: /Users/owen/local/jquery-1.3.2.js, line 613: uncaught JavaScript runtime exception: ReferenceError: document is not defined. Yes, I know that env.js fakes a DOM, but that has to be tested each new release of jQuery, and often requires an upgrade to env.js. So here's the question: is there a way to build a non-DOM jQuery from its parts? Or maybe have a release of jQuery that is in two parts: a core utility kernel with a second part that adds the DOM? (Sorry if this is noob, but searching did not turn up anything.)
[jQuery] Re: jQuery Cycle plugin - addslide (again)
Experimented some more: When I add opts.addSlide(ddblockGetSlideHTML(data.slideImg), fwd == false); The images are appended after the other images, but still not in the slideExpr When I add opts.$cont = '#ddblock-' + opts.ddblocknr + ' .ddblock-container'; before the addslide It puts the slide in the content container I want but after adding one slide the slideshow stops Anyone having suggestion how to append slides with addSlide in the parent of the container defined with slideExpr Thanks Philip Blaauw On Apr 14, 7:30 am, ppblaauw ppbla...@gmail.com wrote: Maybe the issue is really addSlide in combination with slideExpr. When images are added they are prepended instead of appended. So the issue will be how to use slideExpr with addSlide. If more info is needed, please let me know On Apr 13, 8:12 am, ppblaauw ppbla...@gmail.com wrote: I read a lot of posts about this issue, but can not find a solution. Also have seen the addSlide examples for the jQuerycycleplugin. I try to add slides to thecycleplugin with AJAX, one slide at a time with the following code. function onBefore(curr, next, opts, fwd) { // on Before arguments: // curr == DOM element for the slide that is currently being displayed // next == DOM element for the slide that is about to be displayed // opts == slideshow options // fwd == true if cycling forward, false if cycling backward //Slide html creation helper. function ddblockGetSlideHTML(slideImg) { return 'img src=' + slideImg + ' width=200 height=200 alt=/'; }; opts.ajaxLoadSlides = 1; // Will be set later from UI opts.totalSlideCount = 6; //Will be set later from UI //load slides dynamically if (opts.ajaxLoadSlides) { // on the first pass, addSlide is undefined (pluginhasn't yet created the fn); // when we're finshed adding slides we'll null it out again if (!opts.addSlide){ return; } if (opts.nextSlide + 1 == opts.totalSlideCount) { // final slide in our slide slideshow is about to be displayed // so there are no more to fetch alert('last slide to be dislayed, nothing to add anymore'); opts.addSlide = null; return; } // Retrieve slide from server via AJAX, call; if successful the // anonymous function in voteSaved is run. $.ajax({ type: 'POST', // Use the POST method. url: 'get_image_slides', dataType: 'json', data: {js:true,origin:'ddblock',curr_slide:opts.currSlide,next_slide:opts.nextSli de,delta:opts.ddblocknr}, success: function(data) { // add our next slide opts.addSlide(ddblockGetSlideHTML(data.slideImg), fwd == true); }, error: function(xhr) { //alert('Error: ' + xhr.status + ' ' + xhr.statusText); } }); } } I first have 2 initial images after that, images are loaded with AJAX The ajax call returns the image ok The problem is that opts.currSlide and opts.Nextslide give strange values so the wrong images are selected. When I look in FF console the post values for currSlide and nextSlide are. 0 - 1 2 - 1 2 - 3 4 - 1 2 - 3 4 - 5 I get the images in the PHP script on nextSlide +2 So i expect : 0 - 1 - get image 3 1 - 2 - get image 4 2 - 3 - get image 5 3 - 4 - get image 6 Another problem is I use slideExpr to select the right content to slide. How can I you use addslide to add slides to the SlideExpr.parent Thanks in advance for any help with this issue Philip Blaauw
[jQuery] How to adjust the position of the of the error message in jQuery
Hi is there any way by which we can adjust the position of the of the error message in jQuery... i.e, not after the input box , some container that I specify (through id). Thanks Amit Shrama
[jQuery] Re: on_mouse_over scrolling
Any ideas? Thanks and have a nice weekend On Apr 16, 5:00 pm, macsig sigbac...@gmail.com wrote: Hi there, I'm trying to implement a simple scrolling system: basically I have a div with a specific height and auto overflow and I want to let the div content scrolling down when the mouse is over an icon. It has to scrol until the end of the content or until the muose is moved. But I cannot make it working so far. Any idea or even better a sample to solve my issue? Thanks fpr any help, I appreciate it. Sig
[jQuery] defaultValue in form
I'm trying to convert a simple normal inline JS to jQuery and am not having any luck: input type=text name=q id=q value=Search onfocus=if (this.value == this.defaultValue) this.value = ''; onblur=if (this.value == '') this.value=this.defaultValue; / I can't seem to find the right keyword for defaultValue in jQuery. my code that doesn't work: input type=text name=q id=q value=Search / $(#q).blur(function () { if ($(this).attr(value) == $(this).attr(defaultValue)) { $(this).attr(value) = ''; } }); $(#q).focus(function () { if ($(this).attr(value) == '') { $(this).attr(value) = $(this).attr(defaultValue); } }); any suggestions? Thanks!
[jQuery] clueTip with liveQuery?
How do I get these two to play nice with one another? lol... I am trying to run the clueTip inside a div that is using liveQuery because it was added after the page load via AJAX, any help is appreciated! I tried a few things but I am gonna see first if they are compatible... :)
[jQuery] How to Enable a Disabled Context Menu
I've disabled context menu, on page ready, using the following code: function contextMenu(e){ return false; } function disableContextMenu() { $(document).bind(contextmenu, contextMenu); } Now I cannot enable it with unbind function: $(document).unbind(contextmenu, contextMenu); Thanks, Mohsen.
[jQuery] Re: clueTip with liveQuery?
$('.commoninfo').livequery(function(){ $(this).cluetip({width: '260px', showTitle: false}); }) Figured it out! On Apr 18, 1:55 am, Rogue Lord corrupted.rog...@gmail.com wrote: How do I get these two to play nice with one another? lol... I am trying to run the clueTip inside a div that is using liveQuery because it was added after the page load via AJAX, any help is appreciated! I tried a few things but I am gonna see first if they are compatible... :)
[jQuery] Re: defaultValue in form
It works just fine if you switch the focus with the blur and use attr () correctly :) attr(prop) = retrieve property attr(prop, value) = set property $(#q).focus(function () { if ($(this).attr(value) == $(this).attr(defaultValue)) { $(this).attr(value, ''); } }); $(#q).blur(function () { if ($(this).attr(value) == '') { $(this).attr(value, $(this).attr(defaultValue)); } }); On Apr 18, 9:37 am, Brian Cummiskey br...@hondaswap.com wrote: I'm trying to convert a simple normal inline JS to jQuery and am not having any luck: input type=text name=q id=q value=Search onfocus=if (this.value == this.defaultValue) this.value = ''; onblur=if (this.value == '') this.value=this.defaultValue; / I can't seem to find the right keyword for defaultValue in jQuery. my code that doesn't work: input type=text name=q id=q value=Search / $(#q).blur(function () { if ($(this).attr(value) == $(this).attr(defaultValue)) { $(this).attr(value) = ''; } }); $(#q).focus(function () { if ($(this).attr(value) == '') { $(this).attr(value) = $(this).attr(defaultValue); } }); any suggestions? Thanks!
[jQuery] Re: I need some hints
2009/4/17 András Csányi sayusi.a...@gmail.com: Hi all! I'm developing an php and jQuery based grid (something like this: http://www.phpgrid.com/grid/) for my Thesises and I want to coloring the table row if the mouse over the row. You know, this is the minimal visual feature what is following the users eyes... I tried with css (tr class=css_class with :hover) and jQuery (every tr tag has id and .addClasses and .removeClasses) but I could'nt. I'm not an css and jquery magician. :$ So, I need some hints how can I do this with jquery. Or you can give some tutorial or examples. Appreciate yours help! András Hi all! This is lot of help! Thank you! The solution easy very much :) I did it with css. Thank you again! -- - - -- Csanyi Andras -- http://sayusi.hu -- Sayusi Ando -- Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell
[jQuery] Using $.load() and $.blockUI [blockUI.js]
Hi all, how I can add content from div to div? For example, I have code: .. script type=text/javascript !-- $(document).ready(function() { $(#showDialog).click( function() { $(#container).load('wait.php?ID=374NUMBER=1'); $.blockUI({ message: $(#approve), css:{width:275px} }); } ); $(#yes).click(function() { $.unblockUI({fadeOut:200}); $.blockUI({message: h1Remote call in progress.../h1}); }); $(#no).bind(click, $.unblockUI); } ); // -- /script . body div id=container style=display:none;/div div id=approve style=display:none; cursor: default p id=buttons input type=button id=yes value=Yes input type=button id=no value=No /p /div input id=showDialog type=submit value=Show Dialog /body My task is: On click button load result from file wait.php (where I make some requests to DB), block page ($.blockUI), load result from wait.php and merge it with #approve div. In code $.blockUI({ message: $(#approve), css:{width:275px} }); I need merge #approve div and #container div. I try .append, .appendTo and it's not help. How I can do it? Thanks a lot.
[jQuery] Re: jcarousel and text below image
Thanks Brian. Could you have a look at this and tell me where I am going wrong or could you tell me where to place the information as I have done the following and can still not get it right. I will realy apreciate your help. Thanks Hugo Here is what I have done : I have now added the function as follows in the head and tried the following two lines at three different places but still no luck. The errors seems to have gone away now , but I do not see the Bla. div = $(div style='display:none'blah/div); $(document.body).appendChild(div); 1) I have put the two lines in the function but no luck, 2) I have put the two lines in the fuction below the Return HTML Get Element but no luck. 3) I have put it in its own javascript tags below the declaration of the div as it is but no luck. This is the function now in the head. You can see my code source here. http://www.somewhere2rent.com/test/ I have also made the image smaller just in case the text is behind the image. script type=text/javascript $(function() { whatever(); { jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); }, function(){ div.css({display:'none'}); }); }, }); /script body div id=wrap align=center script type=text/javascript div = $(div style='display:none'blah/div); $(document.body).appendChild(div); /script ul id=mycarousel class=jcarousel-skin-ie7 !-- The content will be dynamically loaded in here -- /ul /div /body /html ANy more help will be apreciated. On Apr 11, 4:29 am, brian bally.z...@gmail.com wrote: There's no need for body onload= when using jquery. As long as the library is included, you need only do: $(function() { whatever(); }); Here, the whatever() function will run as soon as the DOM is loaded (generally, this occurs before the page is displayed). On Fri, Apr 10, 2009 at 11:07 PM, globalpropertyonline@gmail.com globalpropertyonline@gmail.com wrote: Thanks Jay, I have put a function Load() in the head and called it in body onload. and then add the two lines in Javascript just below the Div is declared but it seems to have a javascript error and no Bla is displayed. I tried to change a few things but no luck. This is what I have done. script type=text/javascript function load() { jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); }, function(){ div.css({display:'none'}); }); } /script /head body onload=load() div id=wrap align=center script type=text/javascript div = $(div style='display:none'blah/div); $(document.body).appendChild(div); /script ul id=mycarousel class=jcarousel-skin-ie7 !-- The content will be dynamically loaded in here -- /ul /div On Apr 11, 12:49 am, jay jay.ab...@gmail.com wrote: 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] Re: jcarousel and text below image
Hi Jay, Thanks for the help before but could you please be so kind to see me latest post below to brian and see what I have done so far and tell me where I am going wrong as I am still stuck with the text. I will realy apreciate it. Thanks Hugo On Apr 11, 12:49 am, jay jay.ab...@gmail.com wrote: 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
[jQuery] Re: on_mouse_over scrolling
I think you could easily accomplish that by defining an mouseover handler for your button that does a setInterval() to a function that scrolls your container. The scrolling of your container would be accomplished by fooling around with the scrollTop() function. I've put together a test script: http://pastebin.com/f40bb5800 Where #scroller is the div with overflow. On Apr 18, 8:40 am, Macsig sigbac...@gmail.com wrote: Any ideas? Thanks and have a nice weekend On Apr 16, 5:00 pm, macsig sigbac...@gmail.com wrote: Hi there, I'm trying to implement a simple scrolling system: basically I have a div with a specific height and auto overflow and I want to let the div content scrolling down when the mouse is over an icon. It has to scrol until the end of the content or until the muose is moved. But I cannot make it working so far. Any idea or even better a sample to solve my issue? Thanks fpr any help, I appreciate it. Sig
[jQuery] Re: Validate form onload/reload
Where should I put that code line? This is my JS: script type=text/javascript // extend the current rules with new groovy ones $().ready(function() { var validator = $(#texttests).bind(invalid-form.validate, function() { $(#summary).html(Your form contains + validator.numberOfInvalids() + errors, see details below.); }).validate({ errorElement: div, errorContainer: $(#warning, #summary), errorPlacement: function(error, element) { error.appendTo( element.parent(td).next(td) ); }, success: function(label) { label.text(ok).addClass(success); }, rules: { fullname: { required:true }, bd_yr: { required:true, digits: true }, bd_month: { required:true, digits: true }, bd_day: { required:true, digits: true }, countrynr: { required: true, remote: { url: /lib/checkmobilenr.php, type: post, data: { mobilenr: function() { return $(#mobilenr).val(); } } } }, mobilenr: { required: true, digits: true, remote: { url: /lib/checkmobilenr.php, type: post, data: { countrynr: function() { return $(#countrynr).val(); } } } } , city: { required:true, }, username: { required: true, minlength: 2, remote: /lib/checkusername.php }, password: { required: true, minlength: 5 }, password_confirm: { required: true, minlength: 5, equalTo: #password } }, messages: { fullname: Should be a first and last name, bd_yr: Please enter your year of birth, city: Please enter your city/home town, lastname: Please enter your lastname, username: { required: Enter a username, minlength: jQuery.format(Enter at least {0} characters), remote: jQuery.format({0} is already in use) }, mobilenr: { required: Enter your mobile number, minlength: jQuery.format(Enter at least {0} digits), maxlength: jQuery.format(Not more
[jQuery] Re: Using $.load() and $.blockUI [blockUI.js]
Where in your code are you trying to do this? You should use it like this: $(#content).appendTo (#itemwherecontentneedstobeappendedto); On Apr 18, 12:42 pm, Colonel tcolo...@gmail.com wrote: Hi all, how I can add content from div to div? For example, I have code: .. script type=text/javascript !-- $(document).ready(function() { $(#showDialog).click( function() { $(#container).load('wait.php?ID=374NUMBER=1'); $.blockUI({ message: $(#approve), css:{width:275px} }); } ); $(#yes).click(function() { $.unblockUI({fadeOut:200}); $.blockUI({message: h1Remote call in progress.../h1}); }); $(#no).bind(click, $.unblockUI); } ); // -- /script . body div id=container style=display:none;/div div id=approve style=display:none; cursor: default p id=buttons input type=button id=yes value=Yes input type=button id=no value=No /p /div input id=showDialog type=submit value=Show Dialog /body My task is: On click button load result from file wait.php (where I make some requests to DB), block page ($.blockUI), load result from wait.php and merge it with #approve div. In code $.blockUI({ message: $(#approve), css:{width:275px} }); I need merge #approve div and #container div. I try .append, .appendTo and it's not help. How I can do it? Thanks a lot.
[jQuery] Re: How to Enable a Disabled Context Menu
I tried your code, but for me it works just fine? On Apr 18, 10:47 am, Mohsen Saboorian mohs...@gmail.com wrote: I've disabled context menu, on page ready, using the following code: function contextMenu(e){ return false;} function disableContextMenu() { $(document).bind(contextmenu, contextMenu); } Now I cannot enable it with unbind function: $(document).unbind(contextmenu, contextMenu); Thanks, Mohsen.
[jQuery] Re: Using $.load() and $.blockUI [blockUI.js]
I was tying .append, .appendTo, but it's not working. Can you help me with examples? For example, I have 2 divs: 1 with result from wait.php and 2 with buttons. How I can merge these 2 divs? My full code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleUntitled/title script type=text/javascript src=http://code.jquery.com/jquery- latest.js/script script type=text/javascript src=jquery.blockUI.js?v2.17/ script script type=text/javascript !-- $(document).ready( function() { $(#showDialog).click( function() { $(#container).load('wait.php?ID=374LOT_NUMBER=1'); //$(#container).show(); $(p#buttons).before($(#container).load('wait.php? ID=374NUMBER=1')); //$(#question).html($(#container1).html()); $.blockUI({ message: $(#approve), css:{width:275px} }); } ); $(#yes).click(function() { $.unblockUI({fadeOut:200}); $.blockUI({message: h1Remote call in progress.../h1}); }); $(#no).bind(click, $.unblockUI); } ); // -- /script /head body div id=container style=display:none;/div div id=approve style=display:none; cursor: default p id=buttons input type=button id=yes value=Yes input type=button id=no value=No /p /div input id=showDialog type=submit value=Show Dialog /body /html On 18 апр, 16:35, victorg vr.gerrit...@gmail.com wrote: Where in your code are you trying to do this? You should use it like this: $(#content).appendTo (#itemwherecontentneedstobeappendedto); On Apr 18, 12:42 pm, Colonel tcolo...@gmail.com wrote: Hi all, how I can add content from div to div? For example, I have code: .. script type=text/javascript !-- $(document).ready(function() { $(#showDialog).click( function() { $(#container).load('wait.php?ID=374NUMBER=1'); $.blockUI({ message: $(#approve), css:{width:275px} }); } ); $(#yes).click(function() { $.unblockUI({fadeOut:200}); $.blockUI({message: h1Remote call in progress.../h1}); }); $(#no).bind(click, $.unblockUI); } ); // -- /script . body div id=container style=display:none;/div div id=approve style=display:none; cursor: default p id=buttons input type=button id=yes value=Yes input type=button id=no value=No /p /div input id=showDialog type=submit value=Show Dialog /body My task is: On click button load result from file wait.php (where I make some requests to DB), block page ($.blockUI), load result from wait.php and merge it with #approve div. In code $.blockUI({ message: $(#approve), css:{width:275px} }); I need merge #approve div and #container div. I try .append, .appendTo and it's not help. How I can do it? Thanks a lot.
[jQuery] Merge 2 divs [jQuery]
Hi all, I have 2 divs. How I can merge this 2 divs (first div I have after $.load like this $(#div1).load(file.php)) by jQuery? I was trying .append, .appedndTo, but it's not working. May be Am not properly trying. $(#div2).append($(#div1)); $(#div2).append($(#div1).html); $(#div2).append(#div1); $(#div1).appendTo($(#div2)); $(#div1).appendTo($(#div2).html); $(#div1).appendTo(#div2); Sorry, I just study learn jQuery. Thanks.
[jQuery] Form Submit Button to be activated when the fields are modified
Hi guys, I'm kind of new to jQuery and what I'm trying to fogure out is this. What I'm trying to achieve is to have the submit button of a form, that may or may not be filled in with some content when the page is loading, and only have the Submit button activated when something is filled in (if the form was empty) or when something is modified in one of the form's fields (if there was something filled in). Is there a jQuery plugin that provides this functionality, or would it be possible to code something like this? Thank you in advance for your support, Constantin TOVISI
[jQuery] JCarousel Bug (hiding/showing dynamic carousel)
Hi guys I've discovered some really strange behavior with hiding/showing a dynamic jcarousel. Here's the rundown... I have a jcarousel and have it get items dynamically from a web service... Works like a charm... Then I place this jcarousel in a div and hide it on documentready. When I show the parent div I get one of two strange behaviors... Either a) only a 2 pixel slice of the first item in the carousel is rendered until I click the next button or b) it renders only 4 items per page when there is clearly room for 5. If I don't hide the parent div when the page loads, the carousel works fine... I'd need to get this released by monday and I'm losing my mind trying to figure out why. Here's the code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head titleUntitled Page/title script type=text/javascript src=js/jcarousel/lib/ jquery-1.2.3.pack.js/script script type=text/javascript src=js/jcarousel/lib/ jquery.jcarousel.js/script link rel=stylesheet type=text/css href=js/jcarousel/lib/ jquery.jcarousel.css / link rel=stylesheet type=text/css href=js/jcarousel/skins/ custom/skin.css / script type=text/javascript function mycarousel_itemLoadCallback(carousel, state) { // Check if the requested items already exist if (carousel.has(carousel.first, carousel.last)) { return; } var carouselID=carousel.container[0].id; var dataForWebService = {_controlType:2,_startIndex: + carousel.first + ,_endIndex: + carousel.last + }; $.ajax({ type: POST, url: ScrollableListWebService.asmx/ GetSideScrollingControlItems, data: dataForWebService, contentType: application/json; charset=utf-8, dataType: json, success: function(msg) { mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, msg); } }); }; function mycarousel_itemAddCallback(carousel, first, last, valuesContainer) { var values=valuesContainer.ListItems; carousel.size(valuesContainer.TotalLength); for (var x=0;xvalues.length;x++) { var item = values[x]; //alert(item.ImageURL); if (item.ImageURL!=null) { //alert('adding item#: ' + (first + x) + ' item html: ' + mycarousel_getItemHTML(item)); carousel.add(first + x, mycarousel_getItemHTML(item)); } } }; /** * Item html creation helper. */ function mycarousel_getItemHTML(item) { return 'img src=' + item.ImageURL + ' width=30 height=36 alt= border=0 /'; }; function onAfterAnimationHandler(carousel, item, i, state, evt) { carousel.remove(i); } jQuery(document).ready(function() { //jQuery('#testDiv1').hide();// UNCOMMENT THIS LINE TO SEE THE BUG SetUpCarousel('historyAreaCarousel'); }); function SetUpCarousel(name) { jQuery('#' + name).jcarousel( { itemVisibleOutCallback: { onAfterAnimation: function(carousel, item, i, state, evt) { onAfterAnimationHandler(carousel, item, i, state, evt); } }, itemLoadCallback: mycarousel_itemLoadCallback, visible:5, scroll:5 }); } function ShowDiv() { jQuery('#testDiv1').show(); } /script /head body a href=javascript: ShowDiv() id=theLinkShow the div/abr / div id=testDiv1 div id=historyAreaCarousel class=jcarousel-skin-ie7 ul !-- The content will be dynamically loaded in here -- /ul /div /div /body /html Any help would be greatly appreciated!
[jQuery] Can I use more than one JQuery code on a page at a time?
I am using the lavalamp navigation and the coda slider on the same page but only one will work at a give time... Can anyone help? Here is the header file I am using... script type=text/javascript src=/assets/scripts/ jquery-1.3.2.min.js/script script type=text/javascript src=/assets/scripts/ jquery.easing.min.js/script script type=text/javascript src=/assets/scripts/ jquery.lavalamp.min.js/script script type=text/javascript $(function() { $(#a).lavaLamp({ fx: backout, speed: 700, click: function(event, menuItem) { return false; } }); }); /script script type=text/javascript src=/assets/scripts/jquery.js/ script script type=text/javascript src=/assets/scripts/ jquery.scrollTo-1.4.1-min.js/script script type=text/javascript src=/assets/scripts/ jquery.localscroll-1.2.7-min.js/script script type=text/javascript src=/assets/scripts/ jquery.serialScroll-1.2.1-min.js/script script type=text/javascript src=/assets/scripts/coda-slider.js charset=utf-8/script If I take away the jquery.js the lavalamp navigation works if I add it the coda slider works and not the nav... Confused. Please Help!!
[jQuery] event problem with jquery
i have following code for jquery and html, !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head script src=../js/jquery-1.3.1.js/script script $(document).ready(function(){ $(#plus).toggle( function(){ $(#child).show(1000); },function(){ $(#child).hide(1000); } ); }); /script style div#main{ width:200px; height:100px; border:1px red dotted; padding:10px 0 0 10px; } #child{ width:300px; height:100px; border:1px blue dotted; margin:0px 0 0 10px; display:none; background:#CC; padding:5px; } /style /head body div id=main img id=plus src=next.png width=10 height=10/ div id=child /div img id=plus src=next.png width=10 height=10/ div id=child /div /div /body /html The script only works for the first image. But i want it for both images... can anyone help me...?
[jQuery] [treeview] IE6 without reset body
I would like to use treeview separated in the navigation container 'main' without resetting Base Font Size in screen.css file to htmlbody { font-size: 16px; font-size: 68.75%;} body { font-size: 68.75%;} Setting main container in screen.css file directly to #main { font-family: Verdana, helvetica, arial, sans-serif; background: #fff; font-size: 68.75%; color: #333; padding: 1em; } works fine in Firefox, but in IE6 the result is an ugly little downshift of the linktext (eg. 'Item 1' for example). Before reinventing something what's already solved I would like to know if there may exist a solution to this problem - a workaround for IE6 within 'main' without changing 'body'
[jQuery] Re: Can you change the type attribute of an input?
You may use something like this var input = $('#input_field'); var hidden = $('input type=text id='+input.attr('id')+' value='+input.val()+' class='+input.attr('class')+' /').insertBefore(input); input.remove(); See http://dev.jquery.com/ticket/1957 for more information newbuntu wrote: I have a hidden old_name input. When new_name is changed, I want the old_name to appear by changing the type from hidden to text. It gives me a script error. I guess I'm not allowed to change the type attribute. However, I can change disabled attribute without problem. Can anyone throw some light on this? Thx! head script $(document).ready(function() { $(#new_name).blur(function () { if (this.value != '') { //$('#dis_name').removeAttr('disabled'); // this works too old_name.value += new_name.value; $('#dis_name').attr('disabled', ''); // set disable to '' $('#old_name').attr('type', 'text'); // set type to 'text' } }); }); /script /head body disabled input id='dis_name' type='text' disabled='disabled' value='Dis/Enable' br old name input id='old_name' type='hidden' value='old ' br new nameinput id='new_name' value='' /body -- View this message in context: http://www.nabble.com/Can-you-change-the-%22type%22-attribute-of-an-%3Cinput%3E--tp22753958s27240p23104580.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: $.get callback function fails - but only in IE
try to set another charset I had similar case, it ws fixed by setting header('Content-Type: text/html; charset=iso-8859-1'); On Apr 15, 2:39 pm, Bjaergager onepr...@gmail.com wrote: I have a function that uses $.get to retrieve xml and in the callback function it will update a form. The function works fine in FF3 - but not in IE7, in IE7 I can see that the $.get DO request the xml with correct parameters - but the callback function never is called. Here's my function - please help me get this right :-) function editPosting(val) { var f = new Array (korseldato,fragtbrevdato,vognnr,chauffor,fragtbrevnr,postnr,vaegt,bemaerkninger); var c = new Array (indbaering,ventetid,tidslevering,genkorsel,lufthavnsgebyr,forgaevesafh,udenkvittering,forgaeves,toldoplag); $.get(ajax/ajax.php, { action: getfragtbrev, id: val, rnd:Math.random } ,function(xml){ setDivVal(#fbid, $(id,xml).text() ); for(i=0;if.length;i++) { setDivVal( #+f[i], $(f[i],xml).text() ); } for(i=0;ic.length;i++) { if( $(c[i],xml).text() == '1') { $(#+c[i]).attr('checked', true); } else { $(#+c[i]).attr('checked', false); } } }); } function setDivVal(div,val) { $(div).val(val); }
[jQuery] Re: cluetip ajax authentication
On Apr 17, 2009, at 11:50 PM, DotnetShadow wrote: Thanks for that, I haven't tried it yet. Does that mean we can now override the error and beforesend method? What happens when there is a redirec? Your documentation hasn't been updated, so not sure what the default behaviour is? I actually temporarly solved it using this: cluetip plugin - Need beforeSend() and error handling override http://groups.google.com/group/jquery-en/browse_thread/thread/ 74ed458... But I will have a go at your new implementation to see how it works I don't really see a solution in that post, other than to modify the plugin script itself, which, of course, isn't advisable. Am I missing something? if you pull down the most recent version from GitHub now, you can just add your own beforeSend callbacks to the ajaxSettings option. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Form Submit Button to be activated when the fields are modified
$('form').bind('submit.disable', function() { return false; }).find(':input').one('change', function() { $(this).closest('form').unbind('submit.disable'); }); This should get you started. You might want to add/remove a class, too, to indicate the form's state. Note that I namespaced the events so I wouldn't unbind any other handlers bound to the form. I also used .one('change', fn) to unbind the submit handler, because after you do this once, you no longer need it. Hope that helps. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 18, 2009, at 12:09 AM, titel wrote: Hi guys, I'm kind of new to jQuery and what I'm trying to fogure out is this. What I'm trying to achieve is to have the submit button of a form, that may or may not be filled in with some content when the page is loading, and only have the Submit button activated when something is filled in (if the form was empty) or when something is modified in one of the form's fields (if there was something filled in). Is there a jQuery plugin that provides this functionality, or would it be possible to code something like this? Thank you in advance for your support, Constantin TOVISI
[jQuery] Re: How can i access iframe content... and manupulate the elements from jquery script from parent ?
In most cases you'll have to include the jQuery to control the iFrame content within the iFrame code itself and add it within a $ (document).ready function. On Apr 17, 9:42 am, Kapse kapse.nar...@gmail.com wrote: Need help!! How can i access iframe content... and manupulate the elements from jquery script from parent ? any ideas... ??
[jQuery] Re: Form Submit Button to be activated when the fields are modified
heh. you could also set the submit input to disabled. something like this: var $mySubmit = $('form :submit'); $mySubmit.attr('disabled', true); $('form :input').one('change', function() { $mySubmit.attr('disabled', false); }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 18, 2009, at 10:08 AM, Karl Swedberg wrote: $('form').bind('submit.disable', function() { return false; }).find(':input').one('change', function() { $(this).closest('form').unbind('submit.disable'); }); This should get you started. You might want to add/remove a class, too, to indicate the form's state. Note that I namespaced the events so I wouldn't unbind any other handlers bound to the form. I also used .one('change', fn) to unbind the submit handler, because after you do this once, you no longer need it. Hope that helps. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 18, 2009, at 12:09 AM, titel wrote: Hi guys, I'm kind of new to jQuery and what I'm trying to fogure out is this. What I'm trying to achieve is to have the submit button of a form, that may or may not be filled in with some content when the page is loading, and only have the Submit button activated when something is filled in (if the form was empty) or when something is modified in one of the form's fields (if there was something filled in). Is there a jQuery plugin that provides this functionality, or would it be possible to code something like this? Thank you in advance for your support, Constantin TOVISI
[jQuery] Syntax
Hi, I've learned jQuery javascript pretty recently. That being said, I'm not entirely confident in my syntax. I've just recently completed some jQuery and it works perfectly in all browsers except IE6. I'm guessing because IE6 is more strict. Anyways, would anyone mind looking through this piece of jQuery, and verify that I'm writing everything correctly? For a demo, you can go to http://cyberantix.org/demo/portfolio/index.html Or my javascrip (I'm using the color and cookie plugin): $(function() { /*Overwrites the CSS that is written incase JS is disabled*/ $(.color-changer).show(); $(.thick).css(margin-bottom, 0px); /*Sets cookie information */ COOKIE_NAME = 'color'; options = { path: '/', expires: 20 }; /* If there is a cookie for the color, it assigns it to a variable here */ color = $.cookie(COOKIE_NAME); /*Here we change the color from the default of blue set in the CSS file, to the color that was in the cookie If there was no color set, it will be null and revert back to the default blue*/ $(.title b).css(color, color); $(.thick).css(backgroundColor, color); $(a.link).css(color, color); $(h2.sub-title b).css(color, color); /*This is where we assign a certain color to each swatch on the page */ $(span.white).click(function(){ color = '#e6f8f2'; }); $(span.yellow).click(function(){ color = '#f8e226'; }); $(span.orange).click(function(){ color = '#f88e39'; }); $(span.pink).click(function(){ color = '#f859e3'; }); $(span.red).click(function(){ color = '#f81631';}); $(span.green).click(function(){ color = '#43f831'; }); $(span.blue).click(function(){ color = '#34a6d3'; }); /*This is creating the fade in and fade out affect of the top links */ $(.top-links a).mouseover(function(){ $(this).css(color, #bdbcc0 ); $(this).animate( { color: color }, 300); }).mouseout(function(){ $(this).animate( { color: #bdbcc0 }, 300); }); /*This creates the animated transistion of color */ $(.color-changer span).click(function(){ $(.title b).animate( { color: color }, 1000); $(.thick).animate( { backgroundColor: color }, 1000); $(a.link).animate( { color: color }, 1000); $(h2.sub-title b).animate( { color: color }, 1000); $.cookie(COOKIE_NAME, color, options); }); /*Color Changer Opacity Animation --IE ISSUE*/ $(.color-changer span).mouseover(function(){ $(this).animate({ opacity: 1 }, 500 ); }).mouseout(function(){ $(this).animate({ opacity: .5 }, 500 ); }); /*Project Image Direction Opacity Animation*/ $(.project-image).mouseover(function(){ $(this).siblings(.image-hover).animate({ opacity: .5 }, 500 ); }).mouseout(function(){ $(this).siblings(.image-hover).animate({ opacity: 0 }, 500 ); }); /* Expansion Contraction of project slides */ $(.project-image).click(function(){ var stateTest = $(this).parent().css('width'); var valueState = parseFloat(stateTest); if (valueState 300) { $(.project).animate({ width: 250px }, 500 ); $(.project-specs).hide(); $(this).siblings(.project-specs).show(); $(this).parent().animate({ width: 510px }, 500 ); } else{ $(this).parent().animate({ width: 250px }, 500 ); $(.project-specs).hide(); } }); /*Gives the function to the right arrow*/ $(.right-arrow).click(function(){ var projectPositionPx = $(.project-list).css('left'); var projectPosition = parseFloat(projectPositionPx); var projectNumber = $('.project').size(); var projectWidth = 260*projectNumber; if ( !$(.project-list).is(':animated') ) { if (projectWidth + projectPosition 300){ var desiredPosition = projectPosition - 260 +px; $(.project-list).animate({ left: desiredPosition }, 1000); } } }); /*Gives the function to the left arrow*/ $(.left-arrow).click(function(){ var projectPositionPx = $(.project-list).css('left'); var projectPosition = parseFloat(projectPositionPx);
[jQuery] Unable to refer to a select element
Hi, I am trying to populate 3 selectboxes - one with years, months and dates. The problem is that I keep getting a Javascript error in Firebug. This is what I try: I have this select: select name=yearFrom style=visibility: hidden;/select // later I set the select property to true and I try to fill it like this: function initDateFrom(){ var dateNow=new Date(); var yearFrom=$(:input[type=select][name=yearFrom]); var monthFrom=$(:input[type=select][name=monthFrom]); var dayFrom=$(:input[type=select][name=dayFrom]); // populate yearFrom select yearFrom.options[0] = new Option( -- jaar -- ,0,true) for(var i=1; i=10; i++){ yearFrom.options[i] = new Option(dateNow.getFullYear() +i,dateNow.getFullYear()+i) } ... etc I get an error yearFrom.options is undefined When I initialy set the visibility property to true this makes no difference, I still get the errormessage. Is it impossible in jQuery to select an element as I do here (var yearFrom=$(:input[type=select][name=yearFrom]);)? Marc
[jQuery] Re: Menu Hover and Selected
Hmm, i've eaten better things :-P I tried to make it work using Firebug but its not a big success, since i cant attach new events after unbinding them somehow.. I think this should work: http://pastebin.com/m4c657bc9 Basically, what i am trying to do is this: Check what the active URL is right now, search for a link which refers to that active url, get the parent element of that url (the image) and trigger its mouseover state to mark it as active. Then i made a modification to the mouseout function to only affect links which are not currently active. On Apr 16, 6:22 pm, Takaya213 nic...@njwebdesign.co.za wrote: I'm afraid you will have to eat your shoe, it doesn't work. :-(( http://www.njwebdesign.co.za/ victorg84 wrote: Small correction.. var activePage = window.location.pathname.substr(1); $(a[href=+activePage+] img).trigger(mouseover); -- View this message in context:http://www.nabble.com/Menu-Hover-and-Selected-tp22999583s27240p230814... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Syntax
Hi Connor, You posted quite a lot of code for us to comb through. You might try isolating the problem by commenting out various portions of your script and see if the uncommented portions still work. Also, see if IE is throwing an error. There's a setting that you can switch to have IE automatically open a dialog when there is a js error. Otherwise, it just puts a little warning icon in the bottom left of the status bar. Since you're animating the color property, I'm guessing that you're using either a color plugin or jQuery UI effects. If it's the latter, you'll have more success getting an answer on the jquery-ui Google Group. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 18, 2009, at 10:40 AM, Connor wrote: Hi, I've learned jQuery javascript pretty recently. That being said, I'm not entirely confident in my syntax. I've just recently completed some jQuery and it works perfectly in all browsers except IE6. I'm guessing because IE6 is more strict. Anyways, would anyone mind looking through this piece of jQuery, and verify that I'm writing everything correctly? For a demo, you can go to http://cyberantix.org/demo/portfolio/index.html Or my javascrip (I'm using the color and cookie plugin): $(function() { /*Overwrites the CSS that is written incase JS is disabled*/ $(.color-changer).show(); $(.thick).css(margin-bottom, 0px); /*Sets cookie information */ COOKIE_NAME = 'color'; options = { path: '/', expires: 20 }; /* If there is a cookie for the color, it assigns it to a variable here */ color = $.cookie(COOKIE_NAME); /*Here we change the color from the default of blue set in the CSS file, to the color that was in the cookie If there was no color set, it will be null and revert back to the default blue*/ $(.title b).css(color, color); $(.thick).css(backgroundColor, color); $(a.link).css(color, color); $(h2.sub-title b).css(color, color); /*This is where we assign a certain color to each swatch on the page */ $(span.white).click(function(){ color = '#e6f8f2';}); $(span.yellow).click(function(){ color = '#f8e226'; }); $(span.orange).click(function(){ color = '#f88e39'; }); $(span.pink).click(function(){ color = '#f859e3'; }); $(span.red).click(function(){ color = '#f81631'; }); $(span.green).click(function(){ color = '#43f831';}); $(span.blue).click(function(){ color = '#34a6d3'; }); /*This is creating the fade in and fade out affect of the top links */ $(.top-links a).mouseover(function(){ $(this).css(color, #bdbcc0 ); $(this).animate( { color: color }, 300); }).mouseout(function(){ $(this).animate( { color: #bdbcc0 }, 300); }); /*This creates the animated transistion of color */ $(.color-changer span).click(function(){ $(.title b).animate( { color: color }, 1000); $(.thick).animate( { backgroundColor: color }, 1000); $(a.link).animate( { color: color }, 1000); $(h2.sub-title b).animate( { color: color }, 1000); $.cookie(COOKIE_NAME, color, options); }); /*Color Changer Opacity Animation --IE ISSUE*/ $(.color-changer span).mouseover(function(){ $(this).animate({ opacity: 1 }, 500 ); }).mouseout(function(){ $(this).animate({ opacity: .5 }, 500 ); }); /*Project Image Direction Opacity Animation*/ $(.project-image).mouseover(function(){ $(this).siblings(.image-hover).animate({ opacity: .5 }, 500 ); }).mouseout(function(){ $(this).siblings(.image-hover).animate({ opacity: 0 }, 500 ); }); /* Expansion Contraction of project slides */ $(.project-image).click(function(){ var stateTest = $(this).parent().css('width'); var valueState = parseFloat(stateTest); if (valueState 300) { $(.project).animate({ width: 250px }, 500 ); $(.project-specs).hide(); $(this).siblings(.project-specs).show(); $(this).parent().animate({ width: 510px }, 500 ); } else{ $(this).parent().animate({ width: 250px }, 500 ); $(.project-specs).hide(); } }); /*Gives the function to the right arrow*/ $(.right-arrow).click(function(){ var projectPositionPx = $(.project-list).css('left'); var projectPosition =
[jQuery] Re: Unable to refer to a select element
Is it impossible in jQuery to select an element as I do here (var yearFrom=$(:input[type=select][name=yearFrom]);)? Marc Yes, i think you should do it like this instead $(select [name=yearFrom]); jQuery will look for an element which actually has a type=select attribute. button name=loadLoad data/button $(:input[type=button]) - no result input type=button name=load value=Load data / $(:input[type=button]) - 1 result
[jQuery] Re: Merge 2 divs [jQuery]
It should work. Have you tried it like this? $(#div1).load(file.php).appendTo(#div2); Or specify a callback when the results are loading and then append it: $(#div1).load(file.php, function() { $(this).appendTo(#content); }); On Apr 18, 3:14 pm, Colonel tcolo...@gmail.com wrote: Hi all, I have 2 divs. How I can merge this 2 divs (first div I have after $.load like this $(#div1).load(file.php)) by jQuery? I was trying .append, .appedndTo, but it's not working. May be Am not properly trying. $(#div2).append($(#div1)); $(#div2).append($(#div1).html); $(#div2).append(#div1); $(#div1).appendTo($(#div2)); $(#div1).appendTo($(#div2).html); $(#div1).appendTo(#div2); Sorry, I just study learn jQuery. Thanks.
[jQuery] Re: Syntax
Well, i have noticed you used an atrribute/value with the same name For example: $(a.link).animate( { color: color }, 1000); I think i've had issues with that in the past as well. Might want to try to change it into: $(a.link).animate( { color: color2 }, 1000); On Apr 18, 5:26 pm, Karl Swedberg k...@englishrules.com wrote: Hi Connor, You posted quite a lot of code for us to comb through. You might try isolating the problem by commenting out various portions of your script and see if the uncommented portions still work. Also, see if IE is throwing an error. There's a setting that you can switch to have IE automatically open a dialog when there is a js error. Otherwise, it just puts a little warning icon in the bottom left of the status bar. Since you're animating the color property, I'm guessing that you're using either a color plugin or jQuery UI effects. If it's the latter, you'll have more success getting an answer on the jquery-ui Google Group. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Apr 18, 2009, at 10:40 AM, Connor wrote: Hi, I've learned jQuery javascript pretty recently. That being said, I'm not entirely confident in my syntax. I've just recently completed some jQuery and it works perfectly in all browsers except IE6. I'm guessing because IE6 is more strict. Anyways, would anyone mind looking through this piece of jQuery, and verify that I'm writing everything correctly? For a demo, you can go tohttp://cyberantix.org/demo/portfolio/index.html Or my javascrip (I'm using the color and cookie plugin): $(function() { /*Overwrites the CSS that is written incase JS is disabled*/ $(.color-changer).show(); $(.thick).css(margin-bottom, 0px); /*Sets cookie information */ COOKIE_NAME = 'color'; options = { path: '/', expires: 20 }; /* If there is a cookie for the color, it assigns it to a variable here */ color = $.cookie(COOKIE_NAME); /*Here we change the color from the default of blue set in the CSS file, to the color that was in the cookie If there was no color set, it will be null and revert back to the default blue*/ $(.title b).css(color, color); $(.thick).css(backgroundColor, color); $(a.link).css(color, color); $(h2.sub-title b).css(color, color); /*This is where we assign a certain color to each swatch on the page */ $(span.white).click(function(){ color = '#e6f8f2'; }); $(span.yellow).click(function(){ color = '#f8e226'; }); $(span.orange).click(function(){ color = '#f88e39'; }); $(span.pink).click(function(){ color = '#f859e3'; }); $(span.red).click(function(){ color = '#f81631'; }); $(span.green).click(function(){ color = '#43f831'; }); $(span.blue).click(function(){ color = '#34a6d3'; }); /*This is creating the fade in and fade out affect of the top links */ $(.top-links a).mouseover(function(){ $(this).css(color, #bdbcc0 ); $(this).animate( { color: color }, 300); }).mouseout(function(){ $(this).animate( { color: #bdbcc0 }, 300); }); /*This creates the animated transistion of color */ $(.color-changer span).click(function(){ $(.title b).animate( { color: color }, 1000); $(.thick).animate( { backgroundColor: color }, 1000); $(a.link).animate( { color: color }, 1000); $(h2.sub-title b).animate( { color: color }, 1000); $.cookie(COOKIE_NAME, color, options); }); /*Color Changer Opacity Animation --IE ISSUE*/ $(.color-changer span).mouseover(function(){ $(this).animate({ opacity: 1 }, 500 ); }).mouseout(function(){ $(this).animate({ opacity: .5 }, 500 ); }); /*Project Image Direction Opacity Animation*/ $(.project-image).mouseover(function(){ $(this).siblings(.image-hover).animate({ opacity: .5 }, 500 ); }).mouseout(function(){ $(this).siblings(.image-hover).animate({ opacity: 0 }, 500 ); }); /* Expansion Contraction of project slides */ $(.project-image).click(function(){ var stateTest = $(this).parent().css('width'); var valueState = parseFloat(stateTest); if (valueState 300) { $(.project).animate({ width: 250px }, 500 ); $(.project-specs).hide(); $(this).siblings(.project-specs).show(); $(this).parent().animate({ width: 510px }, 500 ); } else{ $(this).parent().animate({ width: 250px
[jQuery] show element if class matches current body id (Please help) « View previous topic :: View next topi c » Author
hi Im new to jquery and having some trouble adapting the code below. the function is for a accordion menu. I want it to recognize the body's id, and show the sub menu who's class matches the body id. right now it is set to show the submenu with class=test. function initMenu() { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } $(document).ready(function() {initMenu();}); do i start with something allong the lines of var bodyid = $(body).attr(id); ? Any suggestions greatly appreciated. Thanks -Max
[jQuery] JCarousel - Changing scroll-direction
how do i change the scroll-direction of jcarousel? in horizontal mode the images scroll from right to left, but I want them to move from left to right… Thanks in advance, papillon
[jQuery] show if class matches current body id
Hi im trying to adapt the following function so that if the ul class matches the body's id it will show. Right now it is set to show the ul with the class 'test'. This is for an accordion menu, and would allow the same menu to be an include on all pages. and the appropriate segment would open. function initMenu() { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } $(document).ready(function() {initMenu();}); any suggestions? Thanks!
[jQuery] Re: show if class matches current body id
function initMenu() { if ($('body').attr('id') === $('#menu ul').attr('class')) { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } } $(document).ready(function() {initMenu();}); On Apr 18, 7:54 am, Max mackerma...@gmail.com wrote: Hi im trying to adapt the following function so that if the ul class matches the body's id it will show. Right now it is set to show the ul with the class 'test'. This is for an accordion menu, and would allow the same menu to be an include on all pages. and the appropriate segment would open. function initMenu() { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } $(document).ready(function() {initMenu();}); any suggestions? Thanks!
[jQuery] Re: non-DOM usage? (Rhino in the wild)
Hi Ricardo. Yup, this looks like a good solution. Basically I'm looking for the object model used .. i.e. help in building the object system jQuery uses, along with the usual string, array, enumeration etc utilities. I'm amazed how few people think of JS as a first-class language in itself, or at least as a server-side language. Makes a lot of sense building a webapp to have JS on both sides with JSON in the middle. -- Owen On Apr 17, 7:39 pm, Ricardo ricardob...@gmail.com wrote: Most features of jQuery are DOM related, so what part of it exactly would you like to use? jQuery's source is divided in modules, guess you could take only what you need from each:http://jqueryjs.googlecode.com/svn/trunk/jquery/src/ cheers, - ricardo On Apr 17, 4:02 pm, Owen Densmore o...@backspaces.net wrote: Hi folks. Apparently jQuery can not be used outside the browser .. or at least without a DOM: Rhino 1.7 release 2 2009 03 22 js load('/Users/owen/local/jquery-1.3.2.js'); js: /Users/owen/local/jquery-1.3.2.js, line 613: uncaught JavaScript runtime exception: ReferenceError: document is not defined. Yes, I know that env.js fakes a DOM, but that has to be tested each new release of jQuery, and often requires an upgrade to env.js. So here's the question: is there a way to build a non-DOM jQuery from its parts? Or maybe have a release of jQuery that is in two parts: a core utility kernel with a second part that adds the DOM? (Sorry if this is noob, but searching did not turn up anything.)
[jQuery] Re: show if class matches current body id
Thanks so much for the reply. however i may have worded my question poorly. I need the if statement to replace $('#menu ul.test').show(); so that instead the ul with class test, only the ul with the class matching the body is shown. the rest are hidden. thanks again -Max On Apr 18, 6:50 pm, Nic Hubbard nnhubb...@gmail.com wrote: function initMenu() { if ($('body').attr('id') === $('#menu ul').attr('class')) { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } } $(document).ready(function() {initMenu();}); On Apr 18, 7:54 am, Max mackerma...@gmail.com wrote: Hi im trying to adapt the following function so that if the ul class matches the body's id it will show. Right now it is set to show the ul with the class 'test'. This is for an accordion menu, and would allow the same menu to be an include on all pages. and the appropriate segment would open. function initMenu() { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } $(document).ready(function() {initMenu();}); any suggestions? Thanks!
[jQuery] CMS book question
Has anyone here used this book? : Drupal 6 JavaScript and jQuery I don't know much about using a CMS, but do see alot of call for them in job postings... is drupal pretty good or is there a better CMS to use/learn? Cheers, Calvin
[jQuery] Re: Syntax
Hi, I'm sorry. It was rude of me to assume you guys had nothing better to do than to sort through my own code. I apologize. I had tried to comment out every section of code to isolate the problem, but that hadn't worked for me before. However, I realized the only section I had not commented out was the line to initialize the lightbox ( $ ('a.thumb-frame').lightBox({fixedNavigation:true}); ) . I did that, and didn't throw the error anymore on page load. So can any of you javascript experts see anything wrong with the syntax or is it a compatibility issue? Thanks, Connor On Apr 18, 10:53 am, victorg vr.gerrit...@gmail.com wrote: Well, i have noticed you used an atrribute/value with the same name For example: $(a.link).animate( { color: color }, 1000); I think i've had issues with that in the past as well. Might want to try to change it into: $(a.link).animate( { color: color2 }, 1000); On Apr 18, 5:26 pm, Karl Swedberg k...@englishrules.com wrote: Hi Connor, You posted quite a lot of code for us to comb through. You might try isolating the problem by commenting out various portions of your script and see if the uncommented portions still work. Also, see if IE is throwing an error. There's a setting that you can switch to have IE automatically open a dialog when there is a js error. Otherwise, it just puts a little warning icon in the bottom left of the status bar. Since you're animating the color property, I'm guessing that you're using either a color plugin or jQuery UI effects. If it's the latter, you'll have more success getting an answer on the jquery-ui Google Group. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Apr 18, 2009, at 10:40 AM, Connor wrote: Hi, I've learned jQuery javascript pretty recently. That being said, I'm not entirely confident in my syntax. I've just recently completed some jQuery and it works perfectly in all browsers except IE6. I'm guessing because IE6 is more strict. Anyways, would anyone mind looking through this piece of jQuery, and verify that I'm writing everything correctly? For a demo, you can go tohttp://cyberantix.org/demo/portfolio/index.html Or my javascrip (I'm using the color and cookie plugin): $(function() { /*Overwrites the CSS that is written incase JS is disabled*/ $(.color-changer).show(); $(.thick).css(margin-bottom, 0px); /*Sets cookie information */ COOKIE_NAME = 'color'; options = { path: '/', expires: 20 }; /* If there is a cookie for the color, it assigns it to a variable here */ color = $.cookie(COOKIE_NAME); /*Here we change the color from the default of blue set in the CSS file, to the color that was in the cookie If there was no color set, it will be null and revert back to the default blue*/ $(.title b).css(color, color); $(.thick).css(backgroundColor, color); $(a.link).css(color, color); $(h2.sub-title b).css(color, color); /*This is where we assign a certain color to each swatch on the page */ $(span.white).click(function(){ color = '#e6f8f2'; }); $(span.yellow).click(function(){ color = '#f8e226'; }); $(span.orange).click(function(){ color = '#f88e39'; }); $(span.pink).click(function(){ color = '#f859e3'; }); $(span.red).click(function(){ color = '#f81631'; }); $(span.green).click(function(){ color = '#43f831'; }); $(span.blue).click(function(){ color = '#34a6d3'; }); /*This is creating the fade in and fade out affect of the top links */ $(.top-links a).mouseover(function(){ $(this).css(color, #bdbcc0 ); $(this).animate( { color: color }, 300); }).mouseout(function(){ $(this).animate( { color: #bdbcc0 }, 300); }); /*This creates the animated transistion of color */ $(.color-changer span).click(function(){ $(.title b).animate( { color: color }, 1000); $(.thick).animate( { backgroundColor: color }, 1000); $(a.link).animate( { color: color }, 1000); $(h2.sub-title b).animate( { color: color }, 1000); $.cookie(COOKIE_NAME, color, options); }); /*Color Changer Opacity Animation --IE ISSUE*/ $(.color-changer span).mouseover(function(){ $(this).animate({ opacity: 1 }, 500 ); }).mouseout(function(){ $(this).animate({ opacity: .5 }, 500 ); }); /*Project Image Direction Opacity Animation*/ $(.project-image).mouseover(function(){ $(this).siblings(.image-hover).animate({ opacity: .5 }, 500 ); }).mouseout(function(){ $(this).siblings(.image-hover).animate({ opacity: 0 }, 500 ); }); /* Expansion Contraction of project slides */
[jQuery] Re: How to rotate image (in degrees)?
Ricardo, Thank you for that link. Very interesting stuff there. How is SVG support these days? On Apr 18, 1:13 am, Ricardo ricardob...@gmail.com wrote: It is doable with SVG/VML too: http://raphaeljs.com/image-rotation.html cheers, - ricardo On 17 abr, 12:20, Richard D. Worth rdwo...@gmail.com wrote: This is going to require canvas. So a google search for 'rotate image javascript canvas' turned up: http://snippets.dzone.com/posts/show/5514 http://code.google.com/p/jquery-rotate/ http://wilq32.googlepages.com/wilq32.rollimage222 - Richard On Fri, Apr 17, 2009 at 10:44 AM, banacan banaca...@gmail.com wrote: Isn't there someone who knows of such a plugin, or a means to accomplish what I need? On Apr 16, 8:37 am, banacan banaca...@gmail.com wrote: Is there a jquery plugin that will allow an image to be rotated by say 90 - 180 degrees? I'm using it in my background (multiple times) and I want it to appear in different places and rotated so it doesn't appear to be the same image. TIA
[jQuery] Re: How to rotate image (in degrees)?
Thanks Richard, that is just what I needed. Cheers. On Apr 17, 11:20 am, Richard D. Worth rdwo...@gmail.com wrote: This is going to require canvas. So a google search for 'rotate image javascript canvas' turned up: http://snippets.dzone.com/posts/show/5514 http://code.google.com/p/jquery-rotate/ http://wilq32.googlepages.com/wilq32.rollimage222 - Richard On Fri, Apr 17, 2009 at 10:44 AM, banacan banaca...@gmail.com wrote: Isn't there someone who knows of such a plugin, or a means to accomplish what I need? On Apr 16, 8:37 am, banacan banaca...@gmail.com wrote: Is there a jquery plugin that will allow an image to be rotated by say 90 - 180 degrees? I'm using it in my background (multiple times) and I want it to appear in different places and rotated so it doesn't appear to be the same image. TIA
[jQuery] Re: Syntax
Hi, Thanks for all of you help before. It must not have been a syntax error, but an ordering one. I took it out of the js file and put it directly in the page I needed, and it worked. Thanks again, Connor On Apr 18, 1:53 pm, Connor con...@letsbeglobal.com wrote: Hi, I'm sorry. It was rude of me to assume you guys had nothing better to do than to sort through my own code. I apologize. I had tried to comment out every section of code to isolate the problem, but that hadn't worked for me before. However, I realized the only section I had not commented out was the line to initialize the lightbox ( $ ('a.thumb-frame').lightBox({fixedNavigation:true}); ) . I did that, and didn't throw the error anymore on page load. So can any of you javascript experts see anything wrong with the syntax or is it a compatibility issue? Thanks, Connor On Apr 18, 10:53 am, victorg vr.gerrit...@gmail.com wrote: Well, i have noticed you used an atrribute/value with the same name For example: $(a.link).animate( { color: color }, 1000); I think i've had issues with that in the past as well. Might want to try to change it into: $(a.link).animate( { color: color2 }, 1000); On Apr 18, 5:26 pm, Karl Swedberg k...@englishrules.com wrote: Hi Connor, You posted quite a lot of code for us to comb through. You might try isolating the problem by commenting out various portions of your script and see if the uncommented portions still work. Also, see if IE is throwing an error. There's a setting that you can switch to have IE automatically open a dialog when there is a js error. Otherwise, it just puts a little warning icon in the bottom left of the status bar. Since you're animating the color property, I'm guessing that you're using either a color plugin or jQuery UI effects. If it's the latter, you'll have more success getting an answer on the jquery-ui Google Group. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Apr 18, 2009, at 10:40 AM, Connor wrote: Hi, I've learned jQuery javascript pretty recently. That being said, I'm not entirely confident in my syntax. I've just recently completed some jQuery and it works perfectly in all browsers except IE6. I'm guessing because IE6 is more strict. Anyways, would anyone mind looking through this piece of jQuery, and verify that I'm writing everything correctly? For a demo, you can go tohttp://cyberantix.org/demo/portfolio/index.html Or my javascrip (I'm using the color and cookie plugin): $(function() { /*Overwrites the CSS that is written incase JS is disabled*/ $(.color-changer).show(); $(.thick).css(margin-bottom, 0px); /*Sets cookie information */ COOKIE_NAME = 'color'; options = { path: '/', expires: 20 }; /* If there is a cookie for the color, it assigns it to a variable here */ color = $.cookie(COOKIE_NAME); /*Here we change the color from the default of blue set in the CSS file, to the color that was in the cookie If there was no color set, it will be null and revert back to the default blue*/ $(.title b).css(color, color); $(.thick).css(backgroundColor, color); $(a.link).css(color, color); $(h2.sub-title b).css(color, color); /*This is where we assign a certain color to each swatch on the page */ $(span.white).click(function(){ color = '#e6f8f2'; }); $(span.yellow).click(function(){ color = '#f8e226'; }); $(span.orange).click(function(){ color = '#f88e39'; }); $(span.pink).click(function(){ color = '#f859e3'; }); $(span.red).click(function(){ color = '#f81631'; }); $(span.green).click(function(){ color = '#43f831'; }); $(span.blue).click(function(){ color = '#34a6d3'; }); /*This is creating the fade in and fade out affect of the top links */ $(.top-links a).mouseover(function(){ $(this).css(color, #bdbcc0 ); $(this).animate( { color: color }, 300); }).mouseout(function(){ $(this).animate( { color: #bdbcc0 }, 300); }); /*This creates the animated transistion of color */ $(.color-changer span).click(function(){ $(.title b).animate( { color: color }, 1000); $(.thick).animate( { backgroundColor: color }, 1000); $(a.link).animate( { color: color }, 1000); $(h2.sub-title b).animate( { color: color }, 1000); $.cookie(COOKIE_NAME, color, options); }); /*Color Changer Opacity Animation --IE ISSUE*/ $(.color-changer span).mouseover(function(){ $(this).animate({ opacity: 1 }, 500 ); }).mouseout(function(){ $(this).animate({ opacity: .5 }, 500 ); }); /*Project Image Direction Opacity
[jQuery] Re: Unable to refer to a select element
$(select[name=yearFrom]) doesn't work $(:select[name=yearFrom]); doesn't work $(:input [name=yearFrom]) doesn't work $(input[name=yearFrom]); doesn't work There is no :select element in the jQuery docs, only an :input element. There should be a way to select select elements... On Apr 18, 5:35 pm, victorg vr.gerrit...@gmail.com wrote: Is it impossible in jQuery to select an element as I do here (var yearFrom=$(:input[type=select][name=yearFrom]);)? Marc Yes, i think you should do it like this instead $(select [name=yearFrom]); jQuery will look for an element which actually has a type=select attribute. button name=loadLoad data/button $(:input[type=button]) - no result input type=button name=load value=Load data / $(:input[type=button]) - 1 result
[jQuery] Re: localScroll not working in Internet Explorer
Haven't gotten too deep when checking it.. but I advice you to use serialScroll for the prev/next part. It integrates perfectly with localScroll and both would share one single scrollTo so it's just a few more bytes. Cheers -- Ariel Flesler On Apr 17, 5:06 pm, Dan Pouliot danpoul...@gmail.com wrote: I have a web form that I'm using localScroll to 'paginate' the form...https://www.omansion.com/weddings_and_parties/event_request_form/ The form scrolls to the right perfectly in Firefox and Safari, but not internet explorer (6 or 7). It has something to do with the fact that the hrefs of the previous/ next buttons on the page are assigned dynamically. If I hard code the previous and next button hrefs, it works fine in IE. Unfortunately it is REALLY cumbersome to re-code this page with hard coded buttons. I'd like to keep them dynamic if possible. I don't know much about binding, is this a binding issue? Any ideas would be greatly appreciated! Dan
[jQuery] Re: Unable to refer to a select element
Even if I add an id to the select element and try to select by Id, I cannot get a reference to it: select name=yearFrom id=yearFrom style=visibility: hidden;/ select yearfrom = $(#yearFrom) gives me the error yearFrom.options is undefined when I try to get to the yearfrom.options[0] array... Luckily document.getElementById(yearFrom) still works so I give up trying to use jQuery with select boxes ...
[jQuery] Re: Any reason why this section of code shouldn't work?
.each Where's the $ or jQuery so it's $.each or jQuery.each And why hog up memory with an array just to join the array? .append makes a whole lot more sense there On Apr 18, 2:42 pm, Rick Faircloth r...@whitestonemedia.com wrote: I know this is out of context, but assuming everything is correct...is anything wrong with this code? I get data in Firebug, no errors, but none of the code below is written into the DOM... Thoughts? Thanks, Rick -- function populateSectionsDivs(response) { $('#viewSectionsForEditDIV').empty(); var out = []; .each(response.QGETSTORYINFO.DATA, function(i, row) { out.push('div id=storyTitleDIV style=font-weight:bold; height:12px; border:1px solid blue;'Title: ' + row[1]/div'); out.push('div style=height:12px;/div'); out.push('div id=sectionPhotoDIV style=width:200px; float:right; border:1px solid black; height:250px; margin-left:15px; margin-bottom:10px;img src=../site_images/' + row[5] + '/div'); out.push('div id=sectionSubtitleDIV style=font-style:italic; height:12px;row[3]/div'); out.push('div style=height:12px;/div'); out.push('div id=sectionTextDIV style=text-align:justify;row[4]/div'); out.push('div style=height:50px;/div'); }); $('#viewSectionsForEditDIV').html(out.join('')); $('#viewSectionsForEditDIV:hidden').fadeIn(500); } - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Temporarily ignore user input
Hi, I'm trying to find out how to temporarily ignore user input while a search is in progress. The following is the desired behavior. (1) User enters some information (e.g. name and age). (2) User clicks on the search button. (3) $.post() to execute a search in the background. (4) Show a search in progress image in the search area. (5) Ignore any user input while the search is in progress. (6) When the search is done, hide the search in progress image and process user input again. I'd like to find out how to do step (5) above. Is there anything in JQuery that I can use? Thank you.
[jQuery] Re: Any reason why this section of code shouldn't work?
Doh! I knew it was something obvious! Thanks! Re: Speed of join vs .append Back several months ago when I first started working with constructing tables, etc., based on ajax data and inserting the elements into the DOM, I was using .append, but it was extremely slow. Someone suggested the out.push method and it was much faster in IE, FF, and Safari, so I started using that. I ran a few comparison tests between several methods and .append, at least the code I was using, was *much* slower. Rick On Sat, Apr 18, 2009 at 4:33 PM, MorningZ morni...@gmail.com wrote: .each Where's the $ or jQuery so it's $.each or jQuery.each And why hog up memory with an array just to join the array? .append makes a whole lot more sense there On Apr 18, 2:42 pm, Rick Faircloth r...@whitestonemedia.com wrote: I know this is out of context, but assuming everything is correct...is anything wrong with this code? I get data in Firebug, no errors, but none of the code below is written into the DOM... Thoughts? Thanks, Rick -- function populateSectionsDivs(response) { $('#viewSectionsForEditDIV').empty(); var out = []; .each(response.QGETSTORYINFO.DATA, function(i, row) { out.push('div id=storyTitleDIV style=font-weight:bold; height:12px; border:1px solid blue;'Title: ' + row[1]/div'); out.push('div style=height:12px;/div'); out.push('div id=sectionPhotoDIV style=width:200px; float:right; border:1px solid black; height:250px; margin-left:15px; margin-bottom:10px;img src=../site_images/' + row[5] + '/div'); out.push('div id=sectionSubtitleDIV style=font-style:italic; height:12px;row[3]/div'); out.push('div style=height:12px;/div'); out.push('div id=sectionTextDIV style=text-align:justify;row[4]/div'); out.push('div style=height:50px;/div'); }); $('#viewSectionsForEditDIV').html(out.join('')); $('#viewSectionsForEditDIV:hidden').fadeIn(500); } - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Modifying tooltip.js (bassistance.de)
Didn't know if there was an easy way to do a replace-all, to accomplish this. Basically, I wanted to use tooltip for my Wordpress blog, however the requirement for using jQuery in that environment is to -not- use $ (elem), but insteadjQuery(elem). Can I do a global replace in jquery.tooltip.js from $ to jQuery ? Tried so far, but no go. ( the actual result is that the tooltip does not appear, only the default browser tooltip - did not get error messages) I already checked : http://docs.jquery.com/Plugins/Tooltip/tooltip#options .. for any notes on changing to the jQuery() usage. Thanks, Steve
[jQuery] js query and wordpress. Cluetip stops working
Goodmorning I installed wordpress on my website and now my cleutip stops working. HLP! Did I do anything wrong? I installed Lightbox 2 and All in One SEO Pack in wordpress. Deactivated them but stil no cleutip. My site is on www.moof.be It worked perfect before wordpress Really need help... thanxs
[jQuery] Re: Modifying tooltip.js (bassistance.de)
The plugin references only jQuery as a global variable, $ is defined as a local variable. See also http://docs.jquery.com/Plugins/Authoring#Custom_Alias_in_plugin_code Jörn On Sat, Apr 18, 2009 at 11:30 PM, steve steveb...@gmail.com wrote: Didn't know if there was an easy way to do a replace-all, to accomplish this. Basically, I wanted to use tooltip for my Wordpress blog, however the requirement for using jQuery in that environment is to -not- use $ (elem), but instead jQuery(elem). Can I do a global replace in jquery.tooltip.js from $ to jQuery ? Tried so far, but no go. ( the actual result is that the tooltip does not appear, only the default browser tooltip - did not get error messages) I already checked : http://docs.jquery.com/Plugins/Tooltip/tooltip#options .. for any notes on changing to the jQuery() usage. Thanks, Steve
[jQuery] Re: on_mouse_over scrolling
Hi Victor and thanks for your reply. I have wrapped up your code within a $(document).ready(function(){ but when I go over the button I get $(el).scrollTop is not a function [Break on this error]$(el).scrollTop(jQuery(el).scrollTop() + inc); I'm using jQuery 1.2.3. Am I missing something? Thanks again and have a nice day. On Apr 18, 4:00 am, victorg vr.gerrit...@gmail.com wrote: I think you could easily accomplish that by defining an mouseover handler for your button that does a setInterval() to a function that scrolls your container. The scrolling of your container would be accomplished by fooling around with the scrollTop() function. I've put together a test script:http://pastebin.com/f40bb5800 Where #scroller is the div with overflow. On Apr 18, 8:40 am, Macsig sigbac...@gmail.com wrote: Any ideas? Thanks and have a nice weekend On Apr 16, 5:00 pm, macsig sigbac...@gmail.com wrote: Hi there, I'm trying to implement a simple scrolling system: basically I have a div with a specific height and auto overflow and I want to let the div content scrolling down when the mouse is over an icon. It has to scrol until the end of the content or until the muose is moved. But I cannot make it working so far. Any idea or even better a sample to solve my issue? Thanks fpr any help, I appreciate it. Sig
[jQuery] Re: Unable to refer to a select element
Something else must be wrong there, because there has never been a problem with jQuery being able to identify select elements. They are identified by tagName, just like any other element --$('select') -- so there is no need for a :select pseudo class. And of course you should be able to use any other selector, such as id, class, attribute, etc. Do you have a test page we can see? --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 18, 2009, at 4:29 PM, marc wrote: Even if I add an id to the select element and try to select by Id, I cannot get a reference to it: select name=yearFrom id=yearFrom style=visibility: hidden;/ select yearfrom = $(#yearFrom) gives me the error yearFrom.options is undefined when I try to get to the yearfrom.options[0] array... Luckily document.getElementById(yearFrom) still works so I give up trying to use jQuery with select boxes ...
[jQuery] Re: Temporarily ignore user input
I usually create a transparent overlay over the page to prevent additional actions. Usually a div with position:fixed does the job. var showOverlay = function() { var overlay = $('div/div'); overlay.addClass('overlay'); overlay.css({ position: 'fixed', top: 0, bottom: 0, left: 0, right: 0, background: '#fff', opacity: 0.01 }); $(document.body).append(overlay); }; var hideOverlay = function() { $('div.overlay').remove(); }; On 4/18/09, Dragon-Fly999 dragon-fly...@hotmail.com wrote: Hi, I'm trying to find out how to temporarily ignore user input while a search is in progress. The following is the desired behavior. (1) User enters some information (e.g. name and age). (2) User clicks on the search button. (3) $.post() to execute a search in the background. (4) Show a search in progress image in the search area. (5) Ignore any user input while the search is in progress. (6) When the search is done, hide the search in progress image and process user input again. I'd like to find out how to do step (5) above. Is there anything in JQuery that I can use? Thank you. -- -Hector
[jQuery] Re: show if class matches current body id
Is there any particular reason you need JavaScript to do this, instead of just using CSS? #menu ul { display:none; } body#foo ul.foo, body#bar ul.bar, body#foobar ul.foobar { display:block; } On Apr 18, 10:05 am, Max mackerma...@gmail.com wrote: Thanks so much for the reply. however i may have worded my question poorly. I need the if statement to replace $('#menu ul.test').show(); so that instead the ul with class test, only the ul with the class matching the body is shown. the rest are hidden. thanks again -Max On Apr 18, 6:50 pm, Nic Hubbard nnhubb...@gmail.com wrote: function initMenu() { if ($('body').attr('id') === $('#menu ul').attr('class')) { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } } $(document).ready(function() {initMenu();}); On Apr 18, 7:54 am, Max mackerma...@gmail.com wrote: Hi im trying to adapt the following function so that if the ul class matches the body's id it will show. Right now it is set to show the ul with the class 'test'. This is for an accordion menu, and would allow the same menu to be an include on all pages. and the appropriate segment would open. function initMenu() { $('#menu ul').hide(); $('#menu ul.test').show(); $('#menu li a').click( function() { $(this).next().toggle(); } ); } $(document).ready(function() {initMenu();}); any suggestions? Thanks!
[jQuery] How to run cf regex (or regular regex) on this code?
Normally, when I'm trying to cause a passage of text to respond to line breaks, I use this ColdFusion code: #replace(myText, '#chr(13)#', 'br', 'all')# and that keeps the line breaks intact when the text is output to the screen. But how can I write that code inside this js? Or do I have to do it outside the js? (row[4] represents the text) out.push('div id=sectionTextDIV' + row[4] + '/div'); out.push('div id=sectionTextDIVcfoutput#replace(' + row[4] + ', '#chr(13)#', 'br', 'all')#cfoutput/div'); That wouldn't work anyway, since the HTML is being inserted into the DOM via jQuery, so the page isn't being refreshed to trigger the ColdFusion processing. The text, coming from an AJAX function is delivered to the display function in response.QGETSTORYINFO.DATA, and is delivered from a ColdFusion component method via storyStruct.QGETSTORYINFO, so, there's not a chance, that I can see to run the replace operation on the code in the method. Can I somehow run the replace on all the qGetStoryInfo.section_text data after it's queried, then reinsert it into the struct, storyStruct.QGETSTORYINFO ??? Suggestions? Thanks, Rick -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Re: How to run cf regex (or regular regex) on this code?
why not run the replace in the CF function that's returning the data? On Sat, Apr 18, 2009 at 6:12 PM, Rick Faircloth r...@whitestonemedia.com wrote: Normally, when I'm trying to cause a passage of text to respond to line breaks, I use this ColdFusion code: #replace(myText, '#chr(13)#', 'br', 'all')# and that keeps the line breaks intact when the text is output to the screen. But how can I write that code inside this js? Or do I have to do it outside the js? (row[4] represents the text) out.push('div id=sectionTextDIV' + row[4] + '/div'); out.push('div id=sectionTextDIVcfoutput#replace(' + row[4] + ', '#chr(13)#', 'br', 'all')#cfoutput/div'); That wouldn't work anyway, since the HTML is being inserted into the DOM via jQuery, so the page isn't being refreshed to trigger the ColdFusion processing. The text, coming from an AJAX function is delivered to the display function in response.QGETSTORYINFO.DATA, and is delivered from a ColdFusion component method via storyStruct.QGETSTORYINFO, so, there's not a chance, that I can see to run the replace operation on the code in the method. Can I somehow run the replace on all the qGetStoryInfo.section_text data after it's queried, then reinsert it into the struct, storyStruct.QGETSTORYINFO ??? Suggestions? Thanks, Rick -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: How to run cf regex (or regular regex) on this code?
That's one of the thing's I said below that I couldn't see how to do. The cfc method runs a query and retrieves all the data involved, then the query data is stored in storyStruct.QGETSTORYINFO and returned to the calling AJAX function. At what point could I run a regex on the specific piece of data from the query? i.e cfquery name=qGetStoryInfo datasource=#arguments.dsn# select ss.story_id, ss.title, sss.section_id, sss.section_text fromsuccess_stories ss, success_sections sss where ss.story_id = '#arguments.story_id#' and sss.story_id = '#arguments.story_id#' order by #arguments.orderBy# /cfquery cfset storyStruct.MESSAGE = 'Success' cfset storyStruct.QGETSTORYINFO = '#qGetStoryInfo#' cfreturn storyStruct I'm not sure where or how I can run the replace function on the individual pieces of sss.section_text data in the query result or the struct... ??? On Sat, Apr 18, 2009 at 9:15 PM, Charlie Griefer charlie.grie...@gmail.comwrote: why not run the replace in the CF function that's returning the data? On Sat, Apr 18, 2009 at 6:12 PM, Rick Faircloth r...@whitestonemedia.com wrote: Normally, when I'm trying to cause a passage of text to respond to line breaks, I use this ColdFusion code: #replace(myText, '#chr(13)#', 'br', 'all')# and that keeps the line breaks intact when the text is output to the screen. But how can I write that code inside this js? Or do I have to do it outside the js? (row[4] represents the text) out.push('div id=sectionTextDIV' + row[4] + '/div'); out.push('div id=sectionTextDIVcfoutput#replace(' + row[4] + ', '#chr(13)#', 'br', 'all')#cfoutput/div'); That wouldn't work anyway, since the HTML is being inserted into the DOM via jQuery, so the page isn't being refreshed to trigger the ColdFusion processing. The text, coming from an AJAX function is delivered to the display function in response.QGETSTORYINFO.DATA, and is delivered from a ColdFusion component method via storyStruct.QGETSTORYINFO, so, there's not a chance, that I can see to run the replace operation on the code in the method. Can I somehow run the replace on all the qGetStoryInfo.section_text data after it's queried, then reinsert it into the struct, storyStruct.QGETSTORYINFO ??? Suggestions? Thanks, Rick -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Re: cluetip ajax authentication
Thanks for getting back to me, You are correct I had to modify the script hence it was a temporary fix, but now that I can use my own beforeSend() that makes it handy. Does this mean the error callback can also be defined to the ajaxSettings option? The reason I ask is because sometimes you would like your application to redirect to the login page if the forms authentication has expired instead of having the message say content could not be loaded... Thanks once again DonetShadow On Apr 18, 11:29 pm, Karl Swedberg k...@englishrules.com wrote: On Apr 17, 2009, at 11:50 PM, DotnetShadow wrote: Thanks for that, I haven't tried it yet. Does that mean we can now override the error and beforesend method? What happens when there is a redirec? Your documentation hasn't been updated, so not sure what the default behaviour is? I actually temporarly solved it using this: cluetip plugin - Need beforeSend() and error handling override http://groups.google.com/group/jquery-en/browse_thread/thread/ 74ed458... But I will have a go at your new implementation to see how it works I don't really see a solution in that post, other than to modify the plugin script itself, which, of course, isn't advisable. Am I missing something? if you pull down the most recent version from GitHub now, you can just add your own beforeSend callbacks to the ajaxSettings option. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com
[jQuery] Re: cluetip ajax authentication
Yes, absolutely. You can add your own function to any of the $.ajax callback functions in the ajaxSettings option now. Your function will be queued first for beforeSend, complete, and success, after which the plugin's code will run. For error, however, yours will completely override the default. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 18, 2009, at 9:41 PM, DotnetShadow wrote: Thanks for getting back to me, You are correct I had to modify the script hence it was a temporary fix, but now that I can use my own beforeSend() that makes it handy. Does this mean the error callback can also be defined to the ajaxSettings option? The reason I ask is because sometimes you would like your application to redirect to the login page if the forms authentication has expired instead of having the message say content could not be loaded... Thanks once again DonetShadow On Apr 18, 11:29 pm, Karl Swedberg k...@englishrules.com wrote: On Apr 17, 2009, at 11:50 PM, DotnetShadow wrote: Thanks for that, I haven't tried it yet. Does that mean we can now override the error and beforesend method? What happens when there is a redirec? Your documentation hasn't been updated, so not sure what the default behaviour is? I actually temporarly solved it using this: cluetip plugin - Need beforeSend() and error handling override http://groups.google.com/group/jquery-en/browse_thread/thread/ 74ed458... But I will have a go at your new implementation to see how it works I don't really see a solution in that post, other than to modify the plugin script itself, which, of course, isn't advisable. Am I missing something? if you pull down the most recent version from GitHub now, you can just add your own beforeSend callbacks to the ajaxSettings option. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com
[jQuery] Slide to part of a Page
how can i slide down to part of a page (say an a or div#with-id tag)? u know those horizontal or vertical sites?
[jQuery] Re: Slide to part of a Page
Check this out, iceangel... http://flesler.blogspot.com/2007/10/jqueryscrollto.html May be just what you need. hth, Rick On Sat, Apr 18, 2009 at 11:05 PM, iceangel89 iceange...@gmail.com wrote: how can i slide down to part of a page (say an a or div#with-id tag)? u know those horizontal or vertical sites? -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Re: js query and wordpress. Cluetip stops working
Not sure exactly what is causing the problem, but you should upgrade your version of jQuery to 1.3.2 and remove the reference to demo.js, since that one isn't needed. I pulled down your page and made those two changes, and it seemed to work fine from here. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 18, 2009, at 5:42 PM, moof moof wrote: Goodmorning I installed wordpress on my website and now my cleutip stops working. HLP! Did I do anything wrong? I installed Lightbox 2 and All in One SEO Pack in wordpress. Deactivated them but stil no cleutip. My site is on www.moof.be It worked perfect before wordpress Really need help... thanxs
[jQuery] Re: Unable to refer to a select element
jQuery uses CSS3 syntax. To select a select element you use it's tagname, select, just like you would div: var yearfrom = $('select[name=yearFrom]') You get the yearfrom.options undefined error because what you get from the jQuery $() function is a jQuery object, not the DOM element like returned from getElementById. You can access the element in the object like in an array, yearfrom[0].options. On Apr 18, 5:29 pm, marc marc.at.comp...@gmail.com wrote: Even if I add an id to the select element and try to select by Id, I cannot get a reference to it: select name=yearFrom id=yearFrom style=visibility: hidden;/ select yearfrom = $(#yearFrom) gives me the error yearFrom.options is undefined when I try to get to the yearfrom.options[0] array... Luckily document.getElementById(yearFrom) still works so I give up trying to use jQuery with select boxes ...
[jQuery] Re: Slide to part of a Page
Yes thanks! On Apr 19, 11:10 am, Rick Faircloth r...@whitestonemedia.com wrote: Check this out, iceangel... http://flesler.blogspot.com/2007/10/jqueryscrollto.html May be just what you need. hth, Rick On Sat, Apr 18, 2009 at 11:05 PM, iceangel89 iceange...@gmail.com wrote: how can i slide down to part of a page (say an a or div#with-id tag)? u know those horizontal or vertical sites? -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson
[jQuery] Re: Can you change the type attribute of an input?
The error given when you try it says it all: type property can't be changed. It doesn't make any sense to change the type attribute of an input. If you need different data, you should create a new, different input, which is exactly what you are doing with the code you posted :) On Apr 18, 4:49 am, Ivan Podgurskiy i...@cofelab.ru wrote: You may use something like this var input = $('#input_field'); var hidden = $('input type=text id='+input.attr('id')+' value='+input.val()+' class='+input.attr('class')+' /').insertBefore(input); input.remove(); Seehttp://dev.jquery.com/ticket/1957for more information newbuntu wrote: I have a hidden old_name input. When new_name is changed, I want the old_name to appear by changing the type from hidden to text. It gives me a script error. I guess I'm not allowed to change the type attribute. However, I can change disabled attribute without problem. Can anyone throw some light on this? Thx! head script $(document).ready(function() { $(#new_name).blur(function () { if (this.value != '') { //$('#dis_name').removeAttr('disabled'); // this works too old_name.value += new_name.value; $('#dis_name').attr('disabled', ''); // set disable to '' $('#old_name').attr('type', 'text'); // set type to 'text' } }); }); /script /head body disabled input id='dis_name' type='text' disabled='disabled' value='Dis/Enable' br old name input id='old_name' type='hidden' value='old ' br new nameinput id='new_name' value='' /body -- View this message in context:http://www.nabble.com/Can-you-change-the-%22type%22-attribute-of-an-%... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Modifying tooltip.js (bassistance.de)
Thanks Jorn, appreciate the quick helpful response. On Apr 18, 4:13 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: The plugin references only jQuery as a global variable, $ is defined as a local variable. See alsohttp://docs.jquery.com/Plugins/Authoring#Custom_Alias_in_plugin_code Jörn On Sat, Apr 18, 2009 at 11:30 PM, steve steveb...@gmail.com wrote: Didn't know if there was an easy way to do a replace-all, to accomplish this. Basically, I wanted to use tooltip for my Wordpress blog, however the requirement for using jQuery in that environment is to -not- use $ (elem), but instead jQuery(elem). Can I do a global replace in jquery.tooltip.js from $ to jQuery ? Tried so far, but no go. ( the actual result is that the tooltip does not appear, only the default browser tooltip - did not get error messages) I already checked : http://docs.jquery.com/Plugins/Tooltip/tooltip#options .. for any notes on changing to the jQuery() usage. Thanks, Steve
[jQuery] Re: How to run cf regex (or regular regex) on this code?
loop over the query in your CFC method. create an array of structs, and do your replace() function there. then return the array of structs in place of the query (a query is really nothing more than an array of structs anyway). you don't HAVE to return a query, right? On Sat, Apr 18, 2009 at 6:33 PM, Rick Faircloth r...@whitestonemedia.com wrote: That's one of the thing's I said below that I couldn't see how to do. The cfc method runs a query and retrieves all the data involved, then the query data is stored in storyStruct.QGETSTORYINFO and returned to the calling AJAX function. At what point could I run a regex on the specific piece of data from the query? i.e cfquery name=qGetStoryInfo datasource=#arguments.dsn# select ss.story_id, ss.title, sss.section_id, sss.section_text fromsuccess_stories ss, success_sections sss where ss.story_id = '#arguments.story_id#' and sss.story_id = '#arguments.story_id#' order by #arguments.orderBy# /cfquery cfset storyStruct.MESSAGE = 'Success' cfset storyStruct.QGETSTORYINFO = '#qGetStoryInfo#' cfreturn storyStruct I'm not sure where or how I can run the replace function on the individual pieces of sss.section_text data in the query result or the struct... ??? On Sat, Apr 18, 2009 at 9:15 PM, Charlie Griefer charlie.grie...@gmail.com wrote: why not run the replace in the CF function that's returning the data? On Sat, Apr 18, 2009 at 6:12 PM, Rick Faircloth r...@whitestonemedia.com wrote: Normally, when I'm trying to cause a passage of text to respond to line breaks, I use this ColdFusion code: #replace(myText, '#chr(13)#', 'br', 'all')# and that keeps the line breaks intact when the text is output to the screen. But how can I write that code inside this js? Or do I have to do it outside the js? (row[4] represents the text) out.push('div id=sectionTextDIV' + row[4] + '/div'); out.push('div id=sectionTextDIVcfoutput#replace(' + row[4] + ', '#chr(13)#', 'br', 'all')#cfoutput/div'); That wouldn't work anyway, since the HTML is being inserted into the DOM via jQuery, so the page isn't being refreshed to trigger the ColdFusion processing. The text, coming from an AJAX function is delivered to the display function in response.QGETSTORYINFO.DATA, and is delivered from a ColdFusion component method via storyStruct.QGETSTORYINFO, so, there's not a chance, that I can see to run the replace operation on the code in the method. Can I somehow run the replace on all the qGetStoryInfo.section_text data after it's queried, then reinsert it into the struct, storyStruct.QGETSTORYINFO ??? Suggestions? Thanks, Rick -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- - It has been my experience that most bad government is the result of too much government. - Thomas Jefferson -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: How to Enable a Disabled Context Menu
Well, let me clarify it. The two code snippets are inside two separate $(function() {}) (called on page ready). As I verified the first one is called first, and the the second (unbind) one. Is this the case you tested? On Apr 18, 3:42 pm, victorg vr.gerrit...@gmail.com wrote: I tried your code, but for me it works just fine? On Apr 18, 10:47 am, Mohsen Saboorian mohs...@gmail.com wrote: I've disabled context menu, on page ready, using the following code: function contextMenu(e){ return false;} function disableContextMenu() { $(document).bind(contextmenu, contextMenu); } Now I cannot enable it with unbind function: $(document).unbind(contextmenu, contextMenu); Thanks, Mohsen.