[jQuery] How to show one image at a time using jquery cycle plugin?
Hi I have 8 images but before the cycle(scrollUp) start, the first 4 images will display and then it move up one image at a time, and cycle through to the next image Like this: (img1-img2-img3-img4) then (img2-img3-img4-img5) then (img3-img4-img5- img6) then (img4-img5-img6-img7) then (img5-img6-img7-img8) . Anyone can help? Thanks!
[jQuery] How to scrollup one image at a time using jquery cylcle plugin?
Hi I have 8 images but before the cycle(scrollUp) start, the first 4 images will display and then it move up one image at a time, and cycle through to the next image Like this: (img1-img2-img3-img4) then (img2-img3-img4-img5) then (img3-img4- img5- img6) then (img4-img5-img6-img7) then (img5-img6-img7-img8) . Anyone can help? Thanks!
[jQuery] Re: backgroundPosition animation only works horizontal?
I have the same problem. I don't know whats wrong. Different style combinations didn't change anything - does anyone know the reason? greetings On 19 Dez. 2009, 22:05, stevescotthome st...@medportal.ca wrote: I have a background sprite that I want to animate vertical on hover, but it pops in vertically...but if I change it to horizontal it all works fine...is there something Im doing wrong? WORKS $(.I1).hover(function () { $(this).animate({backgroundPosition: '0px -10px'}, 500 ); }, function() { $(this).animate({backgroundPosition: '-10px -10px'}, 500 ); }); FAILS (well, pops, not smooth transition) $(.I1).hover(function () { $(this).animate({backgroundPosition: '-10px 0px'}, 500 ); }, function() { $(this).animate({backgroundPosition: '-10px -10px'}, 500 ); });
[jQuery] Re: Appended element is not draggable
After append new tag, you have to bind the draggable() event again... On Jan 28, 1:42 am, Mircea i...@amsterdamsat.com wrote: Hi I have a container div with some spans. I had set the spans to be dragable and I want to do a function that on click will append a new span to my container and make it also draggable. I manage to append the new span in #selectable container but it is not draggable. My code is: script type=text/javascript $(function() { $(span).draggable();}); /script script type=text/javascript $(document).ready(function(){ $(#selectable).click(function(){ $(#selectable).append(spanThe new span/span); }); }); /script and the markup is: div id=selectable div class=ui-widget-content style=width: 800px; height: 500px; background:#ccc; span class=text draggableItem 1/span span class=text draggableItem 2/span span class=text draggableItem 3/span span class=text draggableItem 4/span span class=text draggableItem 5/span span class=text draggableItem 6/span span class=cloneClone/span p class=clonea p replaced/p /div /div Thank you.
[jQuery] Re: jquery.stylish-select.js - problem in Internet Explorer
Hi, I also got the error and I managed to make it work :) In the stylish-select.js, a changed the following in the navigateList: original: $input.val(text).change(); changed to: $input.val(text); if(!$.browser.msie) $input.change(); Hope I could be of any help. Kim On 11 jan, 04:19, Richard D. Worth rdwo...@gmail.com wrote: My guess is the field you are calling the plugin on also has an ASP.Net validator on it. When the plugin triggers the change event to notify the form element that the user changed the value, the ASP.Net validator receives the event with the wrong target. See http://dev.jqueryui.com/ticket/4071 The plugin could be updated to use fireEvent in IE to prevent this issue. I'm still working on whether it makes sense (and how) to fix this in jQuery core's .trigger. See http://groups.google.com/group/jquery-dev/browse_thread/thread/b37371... - Richard On Sun, Jan 10, 2010 at 1:56 PM, Yvan yvana...@gmail.com wrote: I'm using Jquery's Stylish Select plugin to replace a dropdown box in a form (ie: Facility Type): http://www.coverall.com/cnaws/quoterequest.aspx Although it's working fine in both Firefox and Safari, .. I'm having a problem with it in IE 7/8. The first problem that I'm having is that I'm getting a strange Javascript error message when I click on and try to select one of the options in the dropdown box: Message: 'length' is null or not an object Line: 172 Char: 17 Code: 0 URI: http://www.coverall.com/cnaws/WebResource.axd?d=w7y_20eVwtqkECBvGtTXh... The second problem that I'm having (which I suspect is related to the javascript error message I'm getting in some way) ... is that I am not able to select any of the options in the dropdown box. The page that I'm trying to integrate this into is part of a .NET application. Is it possible that there is something .NET specific that is creating a conflict in IE? How can I fix this? Thanks in advance, - Yvan- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[jQuery] (validate) namespace conflict w/ flowplayer tools?
hi, i appear to be in the midst of troubleshooting a namespace conflict of the $() function. i'm using validate 1.4. i've attempted to use jQuery's noConflict() method, but i'm still missing something. link href=/c/jq/ui.all.css rel=stylesheet type=text/css / script src=http://cdn.jquerytools.org/1.1.2/full/ jquery.tools.min.js type=text/javascript/script script src=/js/jquery.ui.core.js type=text/javascript/script script src=/js/jquery.ui.tabs.js type=text/javascript/script script src=/js/jquery.ui.accordion.js type=text/javascript/ script script type=text/javascript /* ![CDATA[ */ var $j = jQuery.noConflict(); /* ]] */ /script script src=/js/cilp.js type=text/javascript/script script src=/js/jquery.validate.js type=text/javascript/script script src=/js/cilp/validate.js type=text/javascript/script if i comment out the last two external references (the validate files) all is well. here is the validate.js file: $j(function($) { $j.extend( $.validator.messages, { required: 'Required' } ); $j( '#qotw-form' ).validate( { rules: { 'qotw-options': 'required' }, submitHandler: function() { var answer = $j( input[name='qotw-options']:checked ).val (); var correct = answer == 'c' ? true : false; var res = correct ? 'Correct!' : 'Try again!'; $j( '#qotw-answer' ).html(res); }, focusCleanup: true //, debug: true } ); } ); hopefully i'm doing something silly. i just wish i knew an easy way to namespace a given plugin to avoid this problem. thanks for any help!
[jQuery] Re: Help with Column Navigation plugin (list page by selecting a element with particular ID)
Hi, Is there any reply/idea for this email please. Awaiting for reply. Thanks. On Fri, Jan 22, 2010 at 12:50 PM, Asharudeen asharud...@gmail.com wrote: Hi, By using CloumnNavigation plugin ( http://plugins.jquery.com/project/column-navigation), Currently to list the tree list, we need to give the html in the following format, http://plugins.jquery.com/node/ html body ul id=myTree li a href=./Homepage/a ul lia href=./contactContact/a/li lia href=./tsandcsTerms amp; Conditions/a/li lia href=./privacyPrivacy information/a/li /ul /li li a href=./contentsContents/a ul lia href=./page1/Page 1/a/li lia href=./page2/Page 2/a ul lia href=./page2.1/Page 2.1/a/li lia href=./page2.2/Page 2.2/a/li /ul /li lia href=./page3/Page 3/a/li /ul /li /ul /body /html Initially this code will list the 'Home' and 'Contents'. If we click on the particular element it will list the sub elements. Assume, if the li element and anchor element have unique IDs. Is there a way list by using their IDs. Or is there way to list the childs of the particular element. That is if the anchor id for 'Contact' is 'ancID1' and li id is 'idofLi1' then is there a way to list the page as the 'Contact' is selected.. such that the sub elements of 'Contacts' also will be list in page. Is there any way to do it. Thanks in Advance.
Re: [jQuery] Re: Help with Column Navigation plugin (list page by selecting a element with particular ID)
On Fri, Jan 22, 2010 at 12:50 PM, Asharudeen asharud...@gmail.com wrote: Assume, if the li element and anchor element have unique IDs. Is there a way list by using their IDs. Or is there way to list the childs of the particular element. I'm not exactly sure what you're asking but, yes, you could find all children of the clicked menu item: $(#myTree a).click(function() { var immediateChildren = $(this).next().children(li); var allDescendants = $(this).next().find(li); }); Those will find the li elements but you can modify it to get the a elements or the href values or the a text or whatever. Hope that helps - like I said, I'm not sure what you're after, exactly. Nathan
[jQuery] Can JQuery tabs be used to intergrate different apps under 1 UI?
I am lookng for a seamless solution to integrate 3-4 applications under 1 UI. Can JQuery support this? If so, are the any issues with navigation within the tabs as associated to the specific application? -- View this message in context: http://old.nabble.com/Can-JQuery-tabs-be-used-to-intergrate-different-apps-under-1-UI--tp27358544s27240p27358544.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] Re: Help with Column Navigation plugin (list page by selecting a element with particular ID)
Hi, Thanks for your reply. Please go this URL: http://code.google.com/p/jquery-column-navigation/ In this a sample html example will be present. If we use the jquery column navigation plugin, while reload the page by default 'HomePage' and 'Contents' will be listed in the page. If we click on the 'HomePage' the sub elements will be listed. What I need is, while reloading the page, I want to list the sub elements of HomePage/Contacts in the tree by default. (Just assume, I have the unique ID for each li and anchor link.) ie, HomePage/Contents will be in selected state, and the sub elements will be listed by default. I will try your previous reply and update you. Meanwhile, I hope the above requirement is clear. Please let me know, if you need any further details regarding this. Once again thanks for your reply. On Thu, Jan 28, 2010 at 10:26 PM, Nathan Klatt n8kl...@gmail.com wrote: On Fri, Jan 22, 2010 at 12:50 PM, Asharudeen asharud...@gmail.com wrote: Assume, if the li element and anchor element have unique IDs. Is there a way list by using their IDs. Or is there way to list the childs of the particular element. I'm not exactly sure what you're asking but, yes, you could find all children of the clicked menu item: $(#myTree a).click(function() { var immediateChildren = $(this).next().children(li); var allDescendants = $(this).next().find(li); }); Those will find the li elements but you can modify it to get the a elements or the href values or the a text or whatever. Hope that helps - like I said, I'm not sure what you're after, exactly. Nathan
[jQuery] Re: background mouseover fade effect
I've looked at the color plugin, but was unsuccessful, but I will have to try again, I guess. And there is an image behind it, if there weren't then this would be easy, and I would have never asked. Thanks all. On Jan 17, 6:49 pm, MorningZ morni...@gmail.com wrote: For sure check out the color.js plugin (Google jQuery color.js and you'll find it)... it can animate the backgroundColor property, as for color, instead of none, you should be able to use transparent or better yet, just fade to the current page/DOM object background color On Jan 12, 5:25 pm, 1.am.W1z4rd 1.am.w1z...@gmail.com wrote: I need to add a mouseover effect to the navigation for a site that I'm building. I need the backgroundColor to fade from none, to black, and then on mouseout, I need it to fade back to none. This would be easy if I were using two colors, but since I'm using 'none' as one of the color's, I don't know what to do. I have tried: [code] $('.nav_link').hover(function() { $(this).animate({backgroundColor: '#00'});}, function() { $(this).animate({backgroundColor: 'none'});}); [/code] but that doesn't seem to work. Any help / plugin links would be greatly appreciated. Thanks, bye.
Re: [jQuery] Implementing JCrop in Ajax Upload
What do you mean by, the image selection doesnt work? Can you give a clearer description o fwhere you think the problem lies? Are you certain that the path sent back from the server is correct? What does alert(data.path) show? On Wed, Jan 27, 2010 at 8:21 PM, adi sembiring sembiring@gmail.com wrote: Hi , I'm trying to develop image crop using JQuery. I use ajax to upload the image. after the image success fully uploaded. I load the uploaded image using jquery to its container. $(#image_upload).html(img src=' + data.path + ' width=\460\ id=\cropbox\ alt=\cropbox\ /); but the image selection doesnt work. why it could be happened ? this is my code: style type=text/css #preview { width: 150px; height: 150px; overflow: hidden; } /style script type=text/javascript src=?php echo base_url()?asset/jqupload/js/ajaxfileupload.js /script script type=text/javascript src=?php echo base_url()?asset/jcrop/jquery.Jcrop.pack.js /script link rel=stylesheet href=?php echo base_url()?asset/jcrop/jquery.Jcrop.css type=text/css / script type=text/javascript function ajaxFileUpload(){ $(#loading).ajaxStart(function(){ $(this).show(); }).ajaxComplete(function(){ $(this).hide(); }); $.ajaxFileUpload({ url: '?php echo site_url()?/upload/do_upload', secureuri: false, fileElementId: 'fileToUpload', dataType: 'json', success: function(data, status){ if (typeof(data.error) != 'undefined') { if (data.error != '') { $(#image_upload).html(data.error); $(#image_upload).fadeIn(slow); } else { $(#image_upload).html(img src=' + data.path + ' width=\460\ id=\cropbox\ alt=\cropbox\ /); $(#image_upload).fadeIn(slow); $(#orig_h).val(data.width); $(#orig_w).val(data.height); //alert(a href=' + data.path + ' /); } } }, error: function(data, status, e){ $(#image_upload).html(e); $(#image_upload).fadeIn(slow); } }) return false; } $(document).ready(function(){ $(function(){ $('#cropbox').Jcrop({ aspectRatio: 1, setSelect: [0, 0, $(#oring_w).val(), $(#oring_h).val()], onSelect: updateCoords, onChange: updateCoords }); }); function updateCoords(c){ showPreview(c); $(#x).val(c.x); $(#y).val(c.y); $(#w).val(c.w); $(#h).val(c.h); } function showPreview(coords){ var rx = $(#oring_w).val() / coords.w; var ry = $(#oring_h).val() / coords.h; $(#preview img).css({ width: Math.round(rx * $(#oring_w).val()) + 'px', height: Math.round(ry * $(#oring_h).val()) + 'px', marginLeft: '-' + Math.round(rx * coords.x) + 'px', marginTop: '-' + Math.round(ry * coords.y) + 'px' }); } }); /script !-- begin main content -- div id=templatemo_content_area h1 class=content_titleLabel Infohr//h1 div id=templatemo_bi_full h2Label Setting/h2 div id=container /div !--container-- br/ h2Avatar/h2 div class=info /div div id=avatar_container form name=form action= method=POST enctype=multipart/form-data ul li class=leftHalf label class=desc for=lbl_type Change Your Avatar /label div div id=avatar img src=?php echo $avatar? width=130 height=130 / /div div id=avatar_upload input id=fileToUpload name=fileToUpload class=field field value= size=30 tabindex=5 type=file /input id=buttonUpload name=buttonUpload class=btTxt submit type=submit value=Upload onclick=return ajaxFileUpload();/img id=loading src=?php echo base_url()?asset/jqupload/images/loading.gif style=display:none; /div /div /li /ul ul id=crop_container li class=leftHalf label class=desc for=lbl_name Avatar for crop /label div id=image_upload
[jQuery] A different approach to parsing XML, and a little help on processing attributes more efficiently
I spent a couple days looking all over the web for how to do this well. I did some picking and choosing of methods, and I came up with this. It works best in Safari, then FireFox, and then Chrome. I have not tested in IE (do I have to?). It runs up to just over 20,000 lines of XML well, over that memory is working too hard. It is a very linear parser that descends from parent to child nodes as it goes. I commented my code heavily so that it should be pretty understandable. The one place that I could be a bit more efficient is in the processing of the node attributes at each level. I would like to parse out node attributes without specifying them (label and id are pretty acceptable I guess), so any suggestions there would be great. :The FrameWork:: jquery-1.4.min.js :The code $(function(){ $.ajax({ type: GET, url: sites.xml, dataType: xml, success: parseXml }); function parseXml(xml) { //get root element // $(xml).find('sites').each(function(){ //get descentdent element = element/element // $(this).find('element').each(function(){ //set variable as this item to pass to the next function // var PARENT = $(this); //get a bunch of attributes of the PARENT element. THIS COULD BE MORE EFFICIENT // parentLabel = $(this).attr('label'); parentID = $(this).attr('id'); siteLAT = $(this).attr('lat'); siteLNG = $(this).attr('lng'); //set variable as string of PARENT variables// var parentBLOCK = br/ +parentLabel + + parentID + br/; //set variable to post parentBLOCK// var siteBLOCK = $(div).append(parentBLOCK); //get descentdent element of PARENT // $(PARENT).find('element').each(function(){ //set variable as this item to pass to the next function // var THISis = $(this); //get attributes of the THISis element. THIS COULD BE MORE EFFICIENT // thisLabel = $(this).attr('label'); //set variable as string of THISis variables// var thisBLOCK = thisLabel +: Has this latitude + siteLAT + this Longitude +siteLNG; //set variable to post thisBLOCK// siteBLOCK = $(div).append(thisBLOCK + br/); //get descentdent element = THISis// $(THISis).find('element').each(function(){ //get a bunch of attributes of the child elements. THIS COULD BE MORE EFFICIENT // childLabel = $(this).attr('label'); //get text from nodes of THISis chlidren elements // childCopy = $(this).text(); //set variable as string of THISis child variables// var childBLOCK = childLabel + : + childCopy + br/; //set variable to post childBLOCK// siteBLOCK = $(div).append(childBLOCK); }); }); }); }); } }); :The XML ?xml version=1.0 encoding=UTF-8? sites element label=site id=1 lat=66 lng=104 element label=Location element label=citySF/element element label=stateCA/element element label=regionWest Coast/element /element /element element label=site id=2 lat=27 lng=305 element label=Location element label=cityLas Vegas/element element label=stateNV/element element label=regionWest/element /element /element element label=site id=3 lat=106 lng=35 element label=Location element label=cityPittsburgh/element element label=statePenn/element element label=regionNorth East/element /element /element element label=site id=4 lat=77 lng=77
Re: [jQuery] A different approach to parsing XML, and a little help on processing attributes more efficiently
Are you required to use XML? Why not use JSON and avoid all the parsing? If you have to use XML I can make some suggestions to speed up the code a bit. But let's see if that is a requirement or not first. -Mike On Thu, Jan 28, 2010 at 10:32 AM, augur 312...@gmail.com wrote: I spent a couple days looking all over the web for how to do this well. I did some picking and choosing of methods, and I came up with this. It works best in Safari, then FireFox, and then Chrome. I have not tested in IE (do I have to?). It runs up to just over 20,000 lines of XML well, over that memory is working too hard. It is a very linear parser that descends from parent to child nodes as it goes. I commented my code heavily so that it should be pretty understandable. The one place that I could be a bit more efficient is in the processing of the node attributes at each level. I would like to parse out node attributes without specifying them (label and id are pretty acceptable I guess), so any suggestions there would be great. :The FrameWork:: jquery-1.4.min.js :The code $(function(){ $.ajax({ type: GET, url: sites.xml, dataType: xml, success: parseXml }); function parseXml(xml) { //get root element // $(xml).find('sites').each(function(){ //get descentdent element = element/element // $(this).find('element').each(function(){ //set variable as this item to pass to the next function // var PARENT = $(this); //get a bunch of attributes of the PARENT element. THIS COULD BE MORE EFFICIENT // parentLabel = $(this).attr('label'); parentID = $(this).attr('id'); siteLAT = $(this).attr('lat'); siteLNG = $(this).attr('lng'); //set variable as string of PARENT variables// var parentBLOCK = br/ +parentLabel + + parentID + br/; //set variable to post parentBLOCK// var siteBLOCK = $(div).append(parentBLOCK); //get descentdent element of PARENT // $(PARENT).find('element').each(function(){ //set variable as this item to pass to the next function // var THISis = $(this); //get attributes of the THISis element. THIS COULD BE MORE EFFICIENT // thisLabel = $(this).attr('label'); //set variable as string of THISis variables// var thisBLOCK = thisLabel +: Has this latitude + siteLAT + this Longitude +siteLNG; //set variable to post thisBLOCK// siteBLOCK = $(div).append(thisBLOCK + br/); //get descentdent element = THISis// $(THISis).find('element').each(function(){ //get a bunch of attributes of the child elements. THIS COULD BE MORE EFFICIENT // childLabel = $(this).attr('label'); //get text from nodes of THISis chlidren elements // childCopy = $(this).text(); //set variable as string of THISis child variables// var childBLOCK = childLabel + : + childCopy + br/; //set variable to post childBLOCK// siteBLOCK = $(div).append(childBLOCK); }); }); }); }); } }); :The XML ?xml version=1.0 encoding=UTF-8? sites element label=site id=1 lat=66 lng=104 element label=Location element label=citySF/element element label=stateCA/element element label=regionWest Coast/element /element /element element label=site id=2 lat=27 lng=305 element label=Location element label=cityLas Vegas/element element label=stateNV/element element label=regionWest/element /element /element element label=site id=3 lat=106 lng=35 element
[jQuery] web hosting
which is best and cheap hosting solution according to you, also that should have .in domain support thanks dotsonline.in
[jQuery] Re: A different approach to parsing XML, and a little help on processing attributes more efficiently
Funny thing is, my lead engineer said the same thing... Mostly this was an experiment to gain a better understanding of DOM outside of HTML. This is about as exciting as a SAX parser when it comes to speed (5sec in safari for 20K lines, slightly longer in FireFox, and noticeably longer in Chrome), though it is fairly efficient, and gives me exactly the results I was wanting to see. There are some practical applications. Realizing that there is only so much memory out there more efficiency is what I am going for, so any input on this script is helpful. I have approached it this way because I get XML and DOM, and I am getting decent at jQuery. Thus this method was in my range of current understanding. JSON is something that I am just now becoming more familiar with.
[jQuery] Classis ASP integrating Async Treeview Plugin using getJSON. Stops working when using response.write [variable name] instead of simple JSON string
Hi all, I've loved using jQuery these past few months, but I'm really pulling my hair our here. The following is the endpoint asp code that gets called to populate my treeview: % rootid = request.querystring(rootid) json = set Conn = server.CreateObject(ADODB.Connection) Conn.Open strProvider if rootid = source then json = [ set RS = Server.CreateObject(ADODB.RecordSet) Sql = select categoryid,categoryname,(select count(*) from tblcategories where parentid = c1.categoryid) ChildCount from tblcategories c1 where parentid = 0 session(errorsql) = sql set Cmd = Server.CreateObject(ADODB.Command) Cmd.CommandText = Sql Cmd.ActiveConnection = Conn rs.open Cmd if not RS.EOF then GotRows = y arrResultSet = RS.GetRows() numRows = ubound(arrResultSet,2) For i = 0 to numRows categoryid = arrResultSet(0,i) categoryname = arrResultSet(1,i) childcount = cint(arrResultSet(2,i)) json = json {'text': ' categoryname ','id':' categoryid ' if childcount 0 then json = json , 'hasChildren':true end if json = json } if i numRows then json = json , end if Next else GotRows = n json = json {'text': 'No Categories have been created'} end if json = json ] RS.close elseif isnumeric(rootid) and rootid then json = [ set RS = Server.CreateObject(ADODB.RecordSet) Sql = select categoryid,categoryname,(select count(*) from tblcategories where parentid = c1.categoryid) ChildCount from tblcategories c1 where parentid = ? session(errorsql) = sql set Cmd = Server.CreateObject(ADODB.Command) Cmd.Parameters.Append CreateIntParameter(Cmd, rootid, rootid) Cmd.CommandText = Sql Cmd.ActiveConnection = Conn rs.open Cmd if not RS.EOF then GotRows = y arrResultSet = RS.GetRows() numRows = ubound(arrResultSet,2) For i = 0 to numRows categoryid = arrResultSet(0,i) categoryname = arrResultSet(1,i) childcount = cint(arrResultSet(2,i)) json = json {'text': ' categoryname ','id':' categoryid ' if childcount 0 then json = json , 'hasChildren':true end if json = json } if i numRows then json = json , end if Next else GotRows = n end if json = json ] RS.close end if set Cmd = nothing set RS=nothing conn.close set conn=nothing response.write json % This code produces the following JSON string viewable when I hit the page directly with the ?rootid=source parameter: [{'text': 'Cat1.0','id':'1'},{'text': 'Cat1.1','id':'2', 'hasChildren':true},{'text': 'Cat1.2','id':'3'}] Unless I've received a severe blow to the head, I recognize this as valid JSON and just what the treeview needs to produce a flat display of 3 nodes with the second having a '+' sign for expandability. Here's the frustrating part, when I past that string into the body of my asp page, comment out the response.write line, save, and run everything I get the simple tree that I'd expect. When I remove the JSON string, and uncomment the response.write line, nothing happens. I've tried flushing the response object, ending the response object, clearing the response before writing to it, yet nothing seems to work. Please, please help!
[jQuery] Re: Classis ASP integrating Async Treeview Plugin using getJSON. Stops working when using response.write [variable name] instead of simple JSON string
I'd try: Response.ContentType = application/json right before the first writing On Jan 28, 2:32 pm, Jason Knight jason.t.kni...@gmail.com wrote: Hi all, I've loved using jQuery these past few months, but I'm really pulling my hair our here. The following is the endpoint asp code that gets called to populate my treeview: % rootid = request.querystring(rootid) json = set Conn = server.CreateObject(ADODB.Connection) Conn.Open strProvider if rootid = source then json = [ set RS = Server.CreateObject(ADODB.RecordSet) Sql = select categoryid,categoryname,(select count(*) from tblcategories where parentid = c1.categoryid) ChildCount from tblcategories c1 where parentid = 0 session(errorsql) = sql set Cmd = Server.CreateObject(ADODB.Command) Cmd.CommandText = Sql Cmd.ActiveConnection = Conn rs.open Cmd if not RS.EOF then GotRows = y arrResultSet = RS.GetRows() numRows = ubound(arrResultSet,2) For i = 0 to numRows categoryid = arrResultSet(0,i) categoryname = arrResultSet(1,i) childcount = cint(arrResultSet(2,i)) json = json {'text': ' categoryname ','id':' categoryid ' if childcount 0 then json = json , 'hasChildren':true end if json = json } if i numRows then json = json , end if Next else GotRows = n json = json {'text': 'No Categories have been created'} end if json = json ] RS.close elseif isnumeric(rootid) and rootid then json = [ set RS = Server.CreateObject(ADODB.RecordSet) Sql = select categoryid,categoryname,(select count(*) from tblcategories where parentid = c1.categoryid) ChildCount from tblcategories c1 where parentid = ? session(errorsql) = sql set Cmd = Server.CreateObject(ADODB.Command) Cmd.Parameters.Append CreateIntParameter(Cmd, rootid, rootid) Cmd.CommandText = Sql Cmd.ActiveConnection = Conn rs.open Cmd if not RS.EOF then GotRows = y arrResultSet = RS.GetRows() numRows = ubound(arrResultSet,2) For i = 0 to numRows categoryid = arrResultSet(0,i) categoryname = arrResultSet(1,i) childcount = cint(arrResultSet(2,i)) json = json {'text': ' categoryname ','id':' categoryid ' if childcount 0 then json = json , 'hasChildren':true end if json = json } if i numRows then json = json , end if Next else GotRows = n end if json = json ] RS.close end if set Cmd = nothing set RS=nothing conn.close set conn=nothing response.write json % This code produces the following JSON string viewable when I hit the page directly with the ?rootid=source parameter: [{'text': 'Cat1.0','id':'1'},{'text': 'Cat1.1','id':'2', 'hasChildren':true},{'text': 'Cat1.2','id':'3'}] Unless I've received a severe blow to the head, I recognize this as valid JSON and just what the treeview needs to produce a flat display of 3 nodes with the second having a '+' sign for expandability. Here's the frustrating part, when I past that string into the body of my asp page, comment out the response.write line, save, and run everything I get the simple tree that I'd expect. When I remove the JSON string, and uncomment the response.write line, nothing happens. I've tried flushing the response object, ending the response object, clearing the response before writing to it, yet nothing seems to work. Please, please help!
Re: [jQuery] Re: A different approach to parsing XML, and a little help on processing attributes more efficiently
No offense, but that code is really frightening. Not your fault though. JSON is not only much faster than all this XML/DOM garbage, but it is *much* easier to understand and use too! If you're coding JavaScript, you need to know how to use ordinary JavaScript objects and arrays, yes? If you know how to work with those, then you *already know JSON*. Because JSON is just JavaScript objects. (D'oh! JavaScript Object Notation!) So here's your XML file transcribed fairly faithfully into JSON: { sites: [ { label: site, id: 2, lat: 27, lng: 305, location: { city: Las Vegas, state: NV, region: West } }, { label: site, id: 3, lat: 106, lng: 35, location: { city: Pittsburgh, state: Penn, region: North East } } ] } I only included a couple of the entries to keep the example short. As you can see, that's just a JavaScript object. This JavaScript object contains a single property called 'sites'. That property is an array of objects, each one representing a single site. Those site objects have the same properties as your XML file. So here's how you use it. I didn't try to exactly duplicate what your code is doing - I wasn't sure what it was trying to do with all the $('div') calls. Wouldn't those append to every DIV in your page? Oh - is there only a single DIV that you're appending everything to? You should give it an ID and reference it that way instead. Also I realized I didn't quite duplicate what you're doing with those label=Location elements. It looks like you might have other kinds of label=Something elements as well? I didn't notice that, but tell you what, here's the code as I understood it: $.getJSON( 'sites.json', function( json ) { var html = []; html.push( 'div' ); var sites = json.sites; for( var site, i = -1; site = sites[++i]; ) { var location = site.location; html.push( site.label, ' ', site.id, 'br/', 'Lat: ', site.lat, ' Lng: ', site.lng, 'br/', location.city, ', ', location.state, 'br/', location.region ); } html.push( '/div' ); $('#container').html( html.join('') ); }); As you can see, that is many times simpler - and *much* easier to understand - than the XML parsing. Some other speed notes... * The for loop uses a slightly unusual form that is faster than the usual numeric incrementing. * Instead of appending elements to the HTML DOM as we go, we construct a single HTML string and append it in one operation. * That HTML string has an outermost DIV that wraps all the elements inside it. * We construct the HTML string not with += but by pushing the elements onto an array and joining it at the end. There is actually a way to speed this up a slight bit more in IE, but let's leave that for the next installment. :-) As it is now, this code will be many times faster than the XML code - at least one order of magnitude faster, and maybe two. Let me know what the real deal is with those label=location elements and I can suggest how to handle them. -Mike On Thu, Jan 28, 2010 at 11:31 AM, augur 312...@gmail.com wrote: Funny thing is, my lead engineer said the same thing... Mostly this was an experiment to gain a better understanding of DOM outside of HTML. This is about as exciting as a SAX parser when it comes to speed (5sec in safari for 20K lines, slightly longer in FireFox, and noticeably longer in Chrome), though it is fairly efficient, and gives me exactly the results I was wanting to see. There are some practical applications. Realizing that there is only so much memory out there more efficiency is what I am going for, so any input on this script is helpful. I have approached it this way because I get XML and DOM, and I am getting decent at jQuery. Thus this method was in my range of current understanding. JSON is something that I am just now becoming more familiar with.
[jQuery] Re: Autocomplete plugin compatability with jQuery 1.4?
Anthony, The short answer would appear to be no, it's not compatible. To be fair, I'm running a slightly tweaked version of the plugin, so its entirely possible the incompatibility is something I introduced. This seems unlikely, though, since Firebug never even hits the breakpoint I've set in the autocomplete entry point function. On Jan 19, 8:24 am, Anthony Rayner antray...@gmail.com wrote: Hi all, We're using Jörn Zaefferer's awesome 'Autocompletehttp://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/' plugin and wondered if anyone knows if it is compatible with jQuery 1.4? Be very intereseted to find out. Many thanks. Anthony.
Re: [jQuery] Re: Autocomplete plugin compatability with jQuery 1.4?
The latest version is jQuery UI Autocomplete, and it is compatible with jQuery 1.4. You can find it in jQuery UI 1.8rc1: http://blog.jqueryui.com/2010/01/jquery-ui-1-8rc1/ - Richard On Thu, Jan 28, 2010 at 6:44 PM, dirk.diggler mitch.ab...@gmail.com wrote: Anthony, The short answer would appear to be no, it's not compatible. To be fair, I'm running a slightly tweaked version of the plugin, so its entirely possible the incompatibility is something I introduced. This seems unlikely, though, since Firebug never even hits the breakpoint I've set in the autocomplete entry point function. On Jan 19, 8:24 am, Anthony Rayner antray...@gmail.com wrote: Hi all, We're using Jörn Zaefferer's awesome 'Autocomplete http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/' plugin and wondered if anyone knows if it is compatible with jQuery 1.4? Be very intereseted to find out. Many thanks. Anthony.
Re: [jQuery] Implementing JCrop in Ajax Upload
I got it, i must chage the crop function declaration become function jCrop(f) { $(f).Jcrop({ aspectRatio: 1, setSelect: [0,0,150,150], onSelect: updateCoords, onChange: updateCoords }); } and call this function after ajax upload complete My meaning about image selection is a box image selection. While we want to crop an image, we must select the image. and while we have selected the image, the selection box will displayed. path is the url of the image. On Fri, Jan 29, 2010 at 12:52 AM, brian zijn.digi...@gmail.com wrote: What do you mean by, the image selection doesnt work? Can you give a clearer description o fwhere you think the problem lies? Are you certain that the path sent back from the server is correct? What does alert(data.path) show? On Wed, Jan 27, 2010 at 8:21 PM, adi sembiring sembiring@gmail.com wrote: Hi , I'm trying to develop image crop using JQuery. I use ajax to upload the image. after the image success fully uploaded. I load the uploaded image using jquery to its container. $(#image_upload).html(img src=' + data.path + ' width=\460\ id=\cropbox\ alt=\cropbox\ /); but the image selection doesnt work. why it could be happened ? this is my code: style type=text/css #preview { width: 150px; height: 150px; overflow: hidden; } /style script type=text/javascript src=?php echo base_url()?asset/jqupload/js/ajaxfileupload.js /script script type=text/javascript src=?php echo base_url()?asset/jcrop/jquery.Jcrop.pack.js /script link rel=stylesheet href=?php echo base_url()?asset/jcrop/jquery.Jcrop.css type=text/css / script type=text/javascript function ajaxFileUpload(){ $(#loading).ajaxStart(function(){ $(this).show(); }).ajaxComplete(function(){ $(this).hide(); }); $.ajaxFileUpload({ url: '?php echo site_url()?/upload/do_upload', secureuri: false, fileElementId: 'fileToUpload', dataType: 'json', success: function(data, status){ if (typeof(data.error) != 'undefined') { if (data.error != '') { $(#image_upload).html(data.error); $(#image_upload).fadeIn(slow); } else { $(#image_upload).html(img src=' + data.path + ' width=\460\ id=\cropbox\ alt=\cropbox\ /); $(#image_upload).fadeIn(slow); $(#orig_h).val(data.width); $(#orig_w).val(data.height); //alert(a href=' + data.path + ' /); } } }, error: function(data, status, e){ $(#image_upload).html(e); $(#image_upload).fadeIn(slow); } }) return false; } $(document).ready(function(){ $(function(){ $('#cropbox').Jcrop({ aspectRatio: 1, setSelect: [0, 0, $(#oring_w).val(), $(#oring_h).val()], onSelect: updateCoords, onChange: updateCoords }); }); function updateCoords(c){ showPreview(c); $(#x).val(c.x); $(#y).val(c.y); $(#w).val(c.w); $(#h).val(c.h); } function showPreview(coords){ var rx = $(#oring_w).val() / coords.w; var ry = $(#oring_h).val() / coords.h; $(#preview img).css({ width: Math.round(rx * $(#oring_w).val()) + 'px', height: Math.round(ry * $(#oring_h).val()) + 'px', marginLeft: '-' + Math.round(rx * coords.x) + 'px', marginTop: '-' + Math.round(ry * coords.y) + 'px' }); } }); /script !-- begin main content -- div id=templatemo_content_area h1 class=content_titleLabel Infohr//h1 div id=templatemo_bi_full h2Label Setting/h2 div id=container /div !--container-- br/ h2Avatar/h2 div class=info /div div id=avatar_container form name=form action= method=POST enctype=multipart/form-data ul li class=leftHalf label class=desc for=lbl_type Change Your Avatar /label div div id=avatar img src=?php echo $avatar? width=130 height=130 /
[jQuery] Re: A different approach to parsing XML, and a little help on processing attributes more efficiently
Mike, Thanks so much for taking the time for writing this tutorial. I see how this is effective. I attempted to do similar things with the XML however... The Data Objects for JSON are much more simplistic structurally, and a little obtuse for reading visually. As I mentioned this simply is a model that I am working on to traverse XML. The content is not important. That I am able to traverse it is important. In a real world application of this I would be working from an XML delivery. It does not really make too much sense to convert the XML into JSON, though it may make sense to have JSON be an output method for the mechanism delivering the info (something to consider) I will look into using an array for building the output, since I am passing the parent=child variables I should be able to appendTo (div) when I am done now. In a more complex layout I would worry about ID, but for now since there is only one I do not need to worry about it. The Location node was created to add a level of relationship to be traversed. You could look at it as a product with variations, there are Product attributes and Variant attributes all wrapped up in one little bundle. Definitely not a mapping app that I am working on, just the structure lent itself to my test, and also a number of tutorials seems to use locational info. I think that this XML parser could be more efficient in two ways. First in traverse methodology, there has to be some way to declare objects at the top and then process them. Additionally abstracting the process for setting attributes as variables is a place this could get better.
[jQuery] Galleria Plugin question
Hi, I'm using the http://devkick.com/lab/galleria/ Galleria Plugin and I have 2 things I'd like to do. One of them somebody posted on here but it was never determined. I understand CSS pretty well, and I can understand some Javascript, but I can't program in it. 1. The first thing is I'd like to set it up to have the option that when you click on the main image in the gallery it links you to another web page (right now the only option is going to the next image). If possible, I'd like to be able to specify which type I'd like to use. Under the documentation it says: onImage (image,caption,thumb) (function) Here you can define what you want should happen to your image, caption and thumbnail when it's showing. F.ex image.css('display','none').fadeIn(); will fade in each image that is being viewed. All variables are jQuery objects. http://code.google.com/p/galleria/wiki/Options See the documentation here It seems like I could put a function in there that gives the main image a link that I can somehow also specify in the HTML. If so, that would be perfect. If I could do that and also specify in the HTML whether or not the galleria should act in this new linking way or should act regular (going to the next slide on click). 2. The second thing I'd like to do is have the active image thumbnail have an image over it (it'll get incorporated with the design). If somebody could just look through the js file and see where and how thumbnails get activated (right now the only thing that changes is the transparency), and write a could that puts an image right on top of the thumbnail (it's an tiny arrow that indicates thats the active thumbnail). The first is more important to me than the second. Please let me know if this is confusing at all or if anything needs further explanation! Thank you! David -- View this message in context: http://old.nabble.com/Galleria-Plugin-question-tp27366931s27240p27366931.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.