[jQuery] Re: Link Clicks Double Firing
Thanks for clarifying that Bill. I see your issue with my solution. I'm still learning to be a better programmer, and getting your type of feedback is really helpful. Thanks On Jan 14, 6:37 am, bill wrote: > hi pedalpete, your solution does work perfectly fine, sorry for not > making that clear. but if we look beyond the initial implementation we > begin to see a problem: this solution requires two separate pieces of > code to be maintained to handle certain modifications. > > for instance, if the link needs to be changed so that it opens in a > separate window, both the tag and the jq code need to be modified; > and keep in mind these two pieces of code may reside in two different > files. many developers will find the first instance (either the or > the jquery), change it, and move it back to production and think the > problem was completely resolved, then not understand why sometimes > users are going to the right page and sometimes they are still going > to the old one. > > so your proposed solution does resolve the issue originally raised, > however, there are long term issues with it and i would like to see if > there is a better solution that does not introduce the maintenance > problem stated above. > > i appreciate your feedback and hope that i've made my point, however > inelegant, a little clearer! > > On Jan 13, 6:38 pm, pedalpete wrote: > > > > > Hi Bill, > > > I'm still learning lots, and was hoping you could better explain what > > was wrong with my solution (as it seems the other solutions are FAR > > more complicated. > > > What I was trying to acheive was to just disable the link for > > javascript enabled browser, and keep it enabled for those without > > javascript. > > > As the link is inside the cell, and the javascript action is triggered > > on any click within the cell, I believe my recommendation should work > > well in all instances. > > > I believe with .unbind('click'), the click on a link will not be > > interpreted at all, and that the JS will always take the action. > > > I may be misunderstanding what is happening under the covers, but what > > I recommend does not unbind after a click, it would unbind the clicks > > at load time if I've got it right.
[jQuery] Re: Select all items in list on form submit
Can you give a bit more detail? Is the submit not firing? or the .each? I always like to give my selectors an element+class/id, apparently it is more efficient, and I have noticed that some browses (it seems only sometimes) will miss some elements when only using the id/class. But throw some alerts in there so you can see what is not firing, and then we can go from there.
[jQuery] Re: What is the proper way to write this if statement?
Everything that I've seen says you have to check the length of the element you are looking for. So I think you want if($(this).parents('ul').length==0){ $(this).addClass("active"); } If a parent UL was found, the length would be > 0
[jQuery] Re: Link Clicks Double Firing
Hi Bill, I'm still learning lots, and was hoping you could better explain what was wrong with my solution (as it seems the other solutions are FAR more complicated. What I was trying to acheive was to just disable the link for javascript enabled browser, and keep it enabled for those without javascript. As the link is inside the cell, and the javascript action is triggered on any click within the cell, I believe my recommendation should work well in all instances. I believe with .unbind('click'), the click on a link will not be interpreted at all, and that the JS will always take the action. I may be misunderstanding what is happening under the covers, but what I recommend does not unbind after a click, it would unbind the clicks at load time if I've got it right.
[jQuery] Re: Link Clicks Double Firing
You'll want to unbind the click event for the link, this should work $(#factsheets td a').unbind('click'); Since the link is inside the cell, a click on the link should still trigger the link. Let me know how it goes (I don't get to answer questions very often ) On Jan 13, 1:22 pm, Collectonian wrote: > I have a bit of code on one page to make an entire table cell a > clickable area to open a PDF in a new window. It works perfectly, > unless you click the actual physical link. If someone clicks the link, > it opens the link twice in two new windows. Inside the usual document > ready, I have: > > $('#factsheets td').click(function() { > $(this).find('a').each(function(){ > window.open(this.href); > return false; > }); > > }); > > And a snippet of code from the document: > > > > > SRAC > 0230Alligator Production: An Introduction > > > > How can I fix it so that clicking on the link is considered just a > single click instead of two, so that only one window opens? > > ~~ Summer
[jQuery] jquery draggable on live events
I was sure that drag & drop from the jQuery UI wouldn't work on events that are added dynamically to the dom. But I found this thread which says to use '.live('mouseover')' to get it to work, and it seems drag works like a charm. Droppable, I can't seem to get the simplest of 'alerts' after an item has been dropped. Any suggestions? jQuery('div.shift').live('mouseover', function(){ jQuery(this).draggable({ axis: 'y', containment: 'table' }); jQuery(this).droppable({ drop: function(){ alert('dropped'); } }); });
[jQuery] Adding/Removing and Resizing jScrollPane - Reinitializing jScrollPane
I am building a little widget which is using jScrollPane to add a scrollbar for where the data doesn't fit inside the alloted space. When the user clicks on the data, I hide what they had, and show the clicked data in a different format. Sometimes the data needs a scrollbar, sometimes not, and sometimes the ammount of scrolling needs to be resized. I've taken a look at how Kevin Luck reinitializes the jScrollPane with ajax data (mine is not loaded via ajax, just a different display of the data), but I can't seem to get it to work. My code looks like this function addRemovejScrollPane(containedDiv){ alert(jQuery(containedDiv).height()); if(jQuery('div#holdAll').height()=jQuery(containedDiv).height ()){ jQuery('div#holdAll').jScrollPaneRemove(); } } This is attempting to get the height of the child, and if larger, reinitialize the scrollbar, if smaller, remove the scrollbar. Is there a better way to do this? I add the 'containedDiv' because I have all my divs within holdAll, and then I show and hide them based on user actions.
[jQuery] get parent where
I've been trying to get a specific parent element traversing up the DOM until I find it, but it is getting to be some very verbose code, and I'm thinking there must be a better way. I have a bunch of events which is fired on a click, and I am trying to figure out which of the parent divs was clicked. Now I have something like this (this is a simplified version) First Item Second Item Third Item First Item Second Item Third Item First Item Second Item Third Item So, i'm trying to get the id of the div. I was hoping I could do this $(this).parent('div').attr(id); but unfortunately that doesn't work as the first parent is not always a div. So what I end up with is var getParent=$(this).parent().attr(id); if(getParent=='subSecond'){ getParent=$(this).parent().parent().attr(id); } Not the worst code ever, but I think there must be a better way to do this, and it may get more confusing/verbose as I continue to add elements and types. Is there a better way of doing this?
[jQuery] Re: consistently unable to get return false to work, why?
That is what i've always thought James, but Firebug isn't showing any errors. I had actually edited the code and removed a context when i posted, so that is why that element didn't have a closing quote. But i had been constantly changing things, and no errors. However, you are correct that I had an error in the JS in that I had gone back to using $ rather than jQuery in the script, and I think that is what was screwing this up. I still find it very strange that of the many, many times i've used 'return false', i almost never get it to work the first time, and usually, i don't see what I've changed to make it work. Thanks for the help. Pete On Jul 27, 3:50 pm, James wrote: > If the return false fails, it's usually something wrong with parsing > your Javascript that causes the problem. > For example: > $("input#email).after("works"); > > It's missing a closing quote (") after "email". > > On Jul 27, 12:28 pm, pedalpete wrote: > > > > > Thanks John, > > > I wasn't familiar with the .live() before, but of course I'll use that > > where I can. > > > Though I'm honoured and humbled by your response, unfortunately, in > > this case, I'm using a 'submit', and the documentation says i can't > > use .live on submit currently. (I did try and, and it didn't work). > > > .bind doesn't seem as efficient, as I'll be regularly binding/ > > unbinding, but I've added that anyway, and still after the alerts, the > > form submits. > > As the form itself is created on the fly, i've put the bind inside the > > function which creates the form, and unbind before the form is first > > created so that i'm not stuck with the old data. > > > Unfortunately, i'm still stuck with the original problem, return > > false; appears to be ignored. > > > On Jul 27, 2:14 pm, John Resig wrote: > > > > It looks like you're using the old liveQuery plugin. Why not just use > > > .bind() or .live()? > > > > --John > > > > On Mon, Jul 27, 2009 at 5:11 PM, pedalpete wrote: > > > > > So, this isn't related to any one bit of code, but it seems to be a > > > > problem I run into almost everytime i need to stop a form or link for > > > > doing what it was originally intended to do (submit). > > > > > Now, i have used return false; many times, but it never works at > > > > first. > > > > I'm never sure what I end up changing, but something changes, and then > > > > all of a sudden it works, and I am once again left stumped as to what > > > > I did. > > > > > Yesterday, i renamed a class, and all of a sudden, it worked. Changed > > > > the class back, and guess what! It still works, though it hadn't > > > > before ...r > > > > > Today, i'm trying to use a submit, check the e-mail address and then > > > > submit the form via ajax. > > > > Once again, i can't seem to stop the form from submitting. > > > > > There are no other javascript errors coming up in firefox. > > > > my alerts work, so i'm in the right function, but then...the form > > > > submits. > > > > > > > > > jQuery('div#selected form#getEmail').livequery('submit', function > > > > (){ > > > > var sid=jQuery('input.emailsButton', this).attr('id'); > > > > var emailAddress=jQuery('input#email', this).val(); > > > > alert(sid); > > > > if(isValidEmailAddress(emailAddress)) { > > > > alert('works'); > > > > $("input#email).after("works"); > > > > } else { > > > > alert('errored'); > > > > $("input#email, this").after("Email > > > > is > > > > not > > > > valid!"); > > > > > } > > > > return false; > > > > }); > > > > > > > > > I've tried moving the return false; into the if/else, but no changes. > > > > > As mentioned, i think the biggest problem isn't just with this code. > > > > There is something I seem to be doing consistently. > > > > > Thanks
[jQuery] Re: consistently unable to get return false to work, why?
Thanks John, I wasn't familiar with the .live() before, but of course I'll use that where I can. Though I'm honoured and humbled by your response, unfortunately, in this case, I'm using a 'submit', and the documentation says i can't use .live on submit currently. (I did try and, and it didn't work). .bind doesn't seem as efficient, as I'll be regularly binding/ unbinding, but I've added that anyway, and still after the alerts, the form submits. As the form itself is created on the fly, i've put the bind inside the function which creates the form, and unbind before the form is first created so that i'm not stuck with the old data. Unfortunately, i'm still stuck with the original problem, return false; appears to be ignored. On Jul 27, 2:14 pm, John Resig wrote: > It looks like you're using the old liveQuery plugin. Why not just use > .bind() or .live()? > > --John > > > > On Mon, Jul 27, 2009 at 5:11 PM, pedalpete wrote: > > > So, this isn't related to any one bit of code, but it seems to be a > > problem I run into almost everytime i need to stop a form or link for > > doing what it was originally intended to do (submit). > > > Now, i have used return false; many times, but it never works at > > first. > > I'm never sure what I end up changing, but something changes, and then > > all of a sudden it works, and I am once again left stumped as to what > > I did. > > > Yesterday, i renamed a class, and all of a sudden, it worked. Changed > > the class back, and guess what! It still works, though it hadn't > > before ...r > > > Today, i'm trying to use a submit, check the e-mail address and then > > submit the form via ajax. > > Once again, i can't seem to stop the form from submitting. > > > There are no other javascript errors coming up in firefox. > > my alerts work, so i'm in the right function, but then...the form > > submits. > > > > > jQuery('div#selected form#getEmail').livequery('submit', function > > (){ > > var sid=jQuery('input.emailsButton', this).attr('id'); > > var emailAddress=jQuery('input#email', this).val(); > > alert(sid); > > if(isValidEmailAddress(emailAddress)) { > > alert('works'); > > $("input#email).after("works"); > > } else { > > alert('errored'); > > $("input#email, this").after("Email is > > not > > valid!"); > > > } > > return false; > > }); > > > > > I've tried moving the return false; into the if/else, but no changes. > > > As mentioned, i think the biggest problem isn't just with this code. > > There is something I seem to be doing consistently. > > > Thanks
[jQuery] consistently unable to get return false to work, why?
So, this isn't related to any one bit of code, but it seems to be a problem I run into almost everytime i need to stop a form or link for doing what it was originally intended to do (submit). Now, i have used return false; many times, but it never works at first. I'm never sure what I end up changing, but something changes, and then all of a sudden it works, and I am once again left stumped as to what I did. Yesterday, i renamed a class, and all of a sudden, it worked. Changed the class back, and guess what! It still works, though it hadn't before ...r Today, i'm trying to use a submit, check the e-mail address and then submit the form via ajax. Once again, i can't seem to stop the form from submitting. There are no other javascript errors coming up in firefox. my alerts work, so i'm in the right function, but then...the form submits. jQuery('div#selected form#getEmail').livequery('submit', function (){ var sid=jQuery('input.emailsButton', this).attr('id'); var emailAddress=jQuery('input#email', this).val(); alert(sid); if(isValidEmailAddress(emailAddress)) { alert('works'); $("input#email).after("works"); } else { alert('errored'); $("input#email, this").after("Email is not valid!"); } return false; }); I've tried moving the return false; into the if/else, but no changes. As mentioned, i think the biggest problem isn't just with this code. There is something I seem to be doing consistently. Thanks
[jQuery] Re: livequery breaking on inserting html in IE
I've made a bit of progress on this. If I break the html from var getSelected=jQuery(this).parent ('li.show').html(); , and grab each piece seperately, it works. Like this var name=jQuery('#'+eventid+' a.artist').html(); var place=jQuery('#'+eventid+'span.address').html(); etc..etc. then insert each piece individually again. I'm sure this is ineffient, but it gets the job done for now. I'd still love to get some help on this if somebody has a solution. For some reason I have to grab the .html(), and not .text(), because .text() was appending the name times the number of clicks, so if 'future of the left' was clicked 3 times, the name variable would be 'future of the leftfuture of the leftfuture of the left'. No idea why it wouldn't clear out the previous, but text seems to work. On Jul 13, 10:47 am, pedalpete wrote: > I've been working on this for quite a while trying to figure out why I > can only get a click to be recognized by IE once. If a user clicks on > another element, and then goes back to the original one, nothing > happens. > > I've gone right down to this > > jQuery("ul.showList li.show div.showData, ul.myShowsList li.show > div.showData, ul.myFriendsShowsList li.show div.showData, > div#popForecast li.show div.showData, div#gigList li.show > div.showData").livequery('click', function(){ > var getSelected=jQuery(this).parent('li.show').html(); > var eventid=jQuery(this).parent('li.show').attr('id'); > clickedShow(getSelected, eventid); > }); > > function clickedShow(getSelected, eventid){ > var currentSelected=jQuery('div#selectedShow').attr('class'); > > if(currentSelected!=eventid){ > var closeSelected=' />'+getSelected; > > var classToRemove=jQuery('div#selectedShow').attr('class'); > jQuery('div#selectedShow').removeClass(classToRemove).addClass > (eventid).html(closeSelected); > var getAddress=jQuery('div#selectedShow span.address').html(); > var thisCityState=jQuery('div#selectedShow span.cityState').html(); > var showLocation=jQuery('div#selectedShow div.showLocation').html(); > > alert('here6'); > > } > } > > > if I remove the 'getSelected, I can click multiple times, and I'll get > the alert. > If I put in the 'getSelected', I can only click that element once. > > the html within getSelected is like this (copied from debugbar, > therefore it shows the jQuery tags) > > Mon 13 Jul SPAN> > 8:00 pm > > SPAN> > jQuery1247506933342="124">future of the left > > Maxwells > SPAN>' > jQuery1247506933342="845">Hoboken, > > Alternative | Healing & > EasyListening > > > > > So once this is put into the page, and then changed, it can't be re- > inserted later. > > Any ideas on this?
[jQuery] livequery breaking on inserting html in IE
I've been working on this for quite a while trying to figure out why I can only get a click to be recognized by IE once. If a user clicks on another element, and then goes back to the original one, nothing happens. I've gone right down to this jQuery("ul.showList li.show div.showData, ul.myShowsList li.show div.showData, ul.myFriendsShowsList li.show div.showData, div#popForecast li.show div.showData, div#gigList li.show div.showData").livequery('click', function(){ var getSelected=jQuery(this).parent('li.show').html(); var eventid=jQuery(this).parent('li.show').attr('id'); clickedShow(getSelected, eventid); }); function clickedShow(getSelected, eventid){ var currentSelected=jQuery('div#selectedShow').attr('class'); if(currentSelected!=eventid){ var closeSelected=''+getSelected; var classToRemove=jQuery('div#selectedShow').attr('class'); jQuery('div#selectedShow').removeClass(classToRemove).addClass (eventid).html(closeSelected); var getAddress=jQuery('div#selectedShow span.address').html(); var thisCityState=jQuery('div#selectedShow span.cityState').html(); var showLocation=jQuery('div#selectedShow div.showLocation').html(); alert('here6'); } } if I remove the 'getSelected, I can click multiple times, and I'll get the alert. If I put in the 'getSelected', I can only click that element once. the html within getSelected is like this (copied from debugbar, therefore it shows the jQuery tags) Mon 13 Jul 8:00 pm future of the left Maxwells ' Hoboken, Alternative | Healing & EasyListening So once this is put into the page, and then changed, it can't be re- inserted later. Any ideas on this?
[jQuery] Re: trigger click on an anchor
jQuery doesn't care what you are linking to, as long as that file is there, it will be retrieved (I can't think of any reason why not).' you could use $('#clickme').click(function() that would I believe be more efficient On Jul 13, 8:45 am, sso wrote: > if I have a link on my page like this > > triggerclick > > should I be able to click it with jquery? > > on event { > $('#clickme').trigger('click'); > > } > > or will it disallow it because its linking to a file
[jQuery] return false; on links only working on first click in IE
I've been trying to make my very ajaxy site more SEO friendly, lots of the returned actions from ajax can be retrieved as a full page, so it's just a matter of exposing the links. Up until now I've had 'span' tags which I have now changed to 'a href' so that the search engines will follow them. I've added the following code so that if the event should send an ajax request, it does that, or if it should go get the full page, it does that. jQuery('a.mixContent').livequery('click',function(){ var vtid=jQuery(this)..parent('div.controller').parent('li').attr ('id'); alert(eventid); if(eventid!=null){ clicked(getSelected, eventid); } else { jQuery.scrollTo('div#selected'); } return false; }); This works to prevent the link from being followed in FF, and IE7/8. The ajax is triggered properly, and all is good. In IE, if the link is clicked multiple time consecutively, then everything is fine. If the link is clicked once, then another link is clicked, then the user goes back to the previously clicked link, the link is followed, and the above code is ignored. Seems that maybe in IE, the livequery needs to be renewed or something, does that make sense? or is their a way for me to 're- affirm' the link? Seems my other option may be to include the link and a span as I had originally done, and then hide the link via javascript, as I recall that search engines won't follow links hidden by css. Anybody have any suggestions on this?
[jQuery] Re: Cycle Plugin : [cycle] terminating; too few slides: 1
Yeah, but I've seen the same thing in my code, and it turned out I wasn't calling the 'foreach' properly. Look at the response you are getting from the server (I'm assuming ajax) or look for a tag not closed properly or something. Posting code or link is the only way we can help here. On Mar 24, 5:18 pm, Asinox wrote: > Hi, but im doing... i have a foreach with php for load the images, in > the home pages i got the message, but in the another part to the > website is fine... > > On Mar 24, 7:16 pm, pedalpete wrote: > > > The message means that there isn't enough data in the cycle for it to > > cycle through. > > Likely you are only loading your cycle wrapper once, but you didn't > > include any code or a url, so it's tough to tell.
[jQuery] Re: Cycle Plugin : [cycle] terminating; too few slides: 1
The message means that there isn't enough data in the cycle for it to cycle through. Likely you are only loading your cycle wrapper once, but you didn't include any code or a url, so it's tough to tell.
[jQuery] Re: chaining events from different sources
Doesn't look like it would work, as I'm not using an actual jQuery effect (effects are too slow on iPhone), i'm using 'addClass' with native CSS animations Thanks Pete On Mar 20, 4:48 pm, Steve wrote: > Not sure if this will work for you but it will let you set off a chain > of effects: > > http://plugins.jquery.com/project/EffectChain > > On Mar 20, 4:39 pm,pedalpete wrote: > > > I've been trying to work with animation timing, and haven't been able > > to get this to work properly. > > > What I have is that I add a class to an element, and that element is > > transitioned via a css transition. > > I then want to hide a child element once the css transition is > > complete. > > > I've tried to use a callback on the addClass, but it doesn't seem to > > work > > [code] > > $('div#header').addClass('holdForecastMove', function(){ > > $('div#holder').hide();}); > > > [/code] > > > This is for an iphone targetted site, so using .animation isn't an > > option.
[jQuery] chaining events from different sources
I've been trying to work with animation timing, and haven't been able to get this to work properly. What I have is that I add a class to an element, and that element is transitioned via a css transition. I then want to hide a child element once the css transition is complete. I've tried to use a callback on the addClass, but it doesn't seem to work [code] $('div#header').addClass('holdForecastMove', function(){ $('div#holder').hide(); }); [/code] This is for an iphone targetted site, so using .animation isn't an option.
[jQuery] jumpy navigation slides (possibly due to hide, animation order)
I've spent the last few days creating a mobile/iphone optimized version of my site. I looked at jqTouch & iUI, but I thought it would mean a bunch of configuring of new pages, and I wanted to just be able to use my own API and a bunch of code I had already written in order to accomplish this. It actually came together rather well, and i've got something very similar to native UI (sliding left/right on selections, scrolling, etc). On the iPhone, the animations run smooth (i'm using css transitions), but the content hides, then slides, even though the .hide() is far down the page from the slide. I think it would look much better if it slid first and then hid. However, the difference is that the bits that hide, and the bits that slide, are not the same div, so I can't just chain them. If you want to check out a url, go to http://zifimusic.com/v2/mobile Here's the animation code i'm using (note the actually transitions are in the css, but are triggered with the addClass [code] $('li.show').livequery('click', function(){ var targetOffset=$(window).scrollTop(); $('a.back').click(function(){ $('li.selectedShow').remove(); $('div#selectedShow').hide(); $('div#holdForecast').show(); window.scroll(0,targetOffset); $('div#header').addClass('holdForecastBack').removeClass ('holdForecastMove'); }); var showid=$(this).attr('id'); $('div#header').addClass('holdForecastMove'); var getShowid=$(this).attr('id'); var selectedShow=$(this).html(); var artist=$('span.artist',this).text(); var htmlThis = ''+selectedShow +'<\/li>'; $('div#selectedShow').append(htmlThis).show(); $('div#selectedShow li.show').addClass ('selectedShow').removeClass('show'); $('div#holdForecast').hide(); [/code] thanks, pete
[jQuery] jquery on iphone - why does this scroll to the top?
I've been working on an iphone version of my site, and though their are lots of comments re: animation on mobile safari, I actually don't think it's all that bad (maybe it was previous versions, I'm on v.2). I have an iphone like UI working fairly well, where the user can select something and the screen shifts left, and then shows the selection. Back and forth work ok, except that for some reason before it goes shifts left, it scrolls to the top of the screen. I'm not sure why this is happening. a demo is at http://zifimusic.com/v2/mobile what the code does is 1) animate the list left -330px (off the screen) 2) add the appropriate content to a div (which was offscreen is now onscreen) called div#selectedshow 3) scroll to the top of div#selectedShow so that the selected item is always at the top of the screen 4) click the x (it will be a back button eventually) to reverse this process the code is [code] $('div#holdForecast').animate({marginLeft : "-330px"},1000) var getShowid=$(this).attr('id'); var selectedShow=$(this).html(); var htmlThis = ''+selectedShow+'<\/li>'; $('div#selectedShow').html(htmlThis).show().css ({"position":"absolute", "top": topVal}); $('div#selectedShow li.show').addClass ('selectedShow').removeClass('show'); var targetOffset=$('li.selectedShow').offset().top; targetOffset=targetOffset-14; $('html,body').animate({scrollTop: targetOffset},5); var topMenu='<\/a><\/div>'; $('li.selectedShow').prepend(topMenu); [/code] I don't see anything in there that says (scroll to the top), and yet it seems to do that. Is there a better animation sequence I should be using? Should I chain these better than I have? Thanks Pete
[jQuery] make sure animate stays on screen (top of animate anyway).
I started working on a mobile app for my site, and it's working pretty good so far, but I have a problem with the animations. What i've got (you can see it at http://zifimusic.com/v2/mobile), the page gets a list of concerts which is scrollable. clicking a result will slide the list over and show the selection you made. That all works well, and keeps things in position so you return to the same spot you left in the list. However, I was hoping for a way to find the relative position of the selected element in the list. Currently I get the position you clicked, and apply that as the css position to the new focused element. However. that means if you click on an item which is low on your screen, the focused element stays low on the screen. I don't want the selected element at the top of the page, but I do want it at the top of the visible window. So that it is the focus of the screen when the user clicks it. Any idea how to make this happen? Thanks Pete
[jQuery] nyromodal with javascript in ajax response
I've got what should be a fairly simple implementation of the nyromodal (like thickbox). I use the modal multiple times on my page, and call it by just using nyromodal as the class on the a-tag that makes the request. The problem I'm having is that on one page I'm trying to put my javascript widget in the nyromodal so that it can be grabbed there (it doesn't really fit onto my own page as it's the same content as on the main page). However, when I load the nyromodal, the page shows up as blank, it won't show the widget. The page which uses the nyromodal is http:/zifimusic.com/v2 (click the 'get it' button on the right in the widget box). The page that the nyromodal is calling is http://zifimusic.com/v2/widgets/getWidget.html Not sure why this isn't working. I think nyromodal is using an iframe to grab the data, but it might be using ajax (my firebug got screwed up somehow and isn't showing the console anymore. I'm working on that too). If nyromodal isn't using an iframe, and is using ajax instead, is their a way to get the ajax to run after the page has been called (if that is what's causing the problem?
[jQuery] Re: Loading More Entries According to the Users Screen Size
I hope I understand you problem correctly, a bit difficult to get the visual. Two things you didn't specify 1) how many results you expect to get per screen size 2) will subsequent requests result number be equal no matter what size? or also depend on the screen size? What i would suggest is to get the window size (I assume we are talking length) and see if you can get a number from that. For instance 600px/30=20. So if the user had a window height of 600px you would get 20 results. 800px would give you 23. is that too simplistic for what you're looking for?
[jQuery] jquery .data() not sure if I'm using this properly
I'm trying to figure out how to set and retrieve data without putting it into a class, element, or anything else visible, and in the dom. My site is integrating Facebook connect, and sometimes if a user hasn't logged in, I bring them to the login, but I'm trying to remember what function would have run if they were logged in so that I can call that after they login. currently i set the data like this [code] jQuery('ul#otherLogin').data('selectForLogin','getTracked'); [/code] i then later try to get the value for 'selectForLogin like this [code] var refreshWhat=jQuery('div#otherLogin').data('selectForLogin'); [/code] but i always get 'undefined'; i've looked at the documentation http://docs.jquery.com/Data, but it leaves me with two questions 1) why is my data being set 2) do i have to 'remove' a data value? or do they just get overwritten if I set it again? any ideas?
[jQuery] Re: html data in IE
I can't display the 'issue' as i've rewritten the page to get rid of the errors. I'm just not sure if the way I have gone about fixing it is a bad move. On Mar 4, 10:29 am, James wrote: > Can you put up a demo page that displays this issue? > > On Mar 3, 6:15 pm,pedalpete wrote: > > > I've been struggling with IE for a few days now, and looking through > > the HTML check in debugbar, it shows that IE would throw an error on > > every .html(''), so I took any place where I had the > > html defined within the html(). I put the html into a javascript > > variable, and then it told me that the closing / was an invalid > > character. So I commented those out with \/. > > > My question is, should I have done this? > > I can still back out of it, though it doesn't appear to be causing any > > problems in any of the browsers.
[jQuery] Re: placing cycle plugin at root document level to use on content loaded via AJAX
>From what I can tell by the code you've included, your abilities here are much better than mine, but I do load content via Ajax into my cycle, What I had to do was to stop the cycle, empty, then replace and restart. My code looks like this [code] success: function(response){ jQuery('div#popForecast').cycle('stop').empty(); jQuery('div#cyclePager').empty(); jQuery('div#popForecast').html(response); var location=jQuery('input#searchTxt').val(); jQuery('div#popForecast span.location').html(location); startCycle(); } function startCycle(){ jQuery('div#popForecast').cycle({ cleartype: 1, timeout: 9000, speed: 2000, pager: 'div#cyclePager', fx: 'fade', pause: 1, sync: 0, pauseOnPagerHover: 1, pagerAnchorBuilder: function(idx, slide) { var inputHtml='<\/a>'; return inputHtml ; } }); } [/code] On Mar 3, 7:16 pm, kevinm wrote: > I want to relocate my cycle plugin call from the file that is loaded > via an AJAX call to the parent file. I know I can't just copy, but not > sure what I need to do. > > to illustrate; > > put > > $('#fcycle').cycle({ > fx: 'fade', > timeout: 0, > speed: 'slow' , > pager: '#qm0', > next: '#next', > prev: '#prev', > pagerAnchorBuilder: function(idx, slide) { > // return sel string for existing anchor > return '#qm0 li:eq(' + (idx) + ') a'; > } > > }); > > in my index.html > > then I do this to load content > > $sections.click(function(){ > alert('test'); > if( last != this ){ // let's avoid needless requests > var url = '' + this.hash.slice(1) + '.cfm'; > $(this).html( '' ).load( url, function(){ > this.scrollLeft = 0;//scroll back to the left > }); > } > last = this; > this.blur(); // Remove the awful outline > > return false; > }); > > and I want the cycle function to affect content that is loaded (this) > > Thanks
[jQuery] html data in IE
I've been struggling with IE for a few days now, and looking through the HTML check in debugbar, it shows that IE would throw an error on every .html(''), so I took any place where I had the html defined within the html(). I put the html into a javascript variable, and then it told me that the closing / was an invalid character. So I commented those out with \/. My question is, should I have done this? I can still back out of it, though it doesn't appear to be causing any problems in any of the browsers.
[jQuery] Re: Stopping slideUp/slideDown mid animation
Check out the hoverIntent plugin http://cherne.net/brian/resources/jquery.hoverIntent.html it puts a 'pause' on the hover so for both loading and unloading the hovered section, it attempts to figure out what the user wants to do. On Feb 25, 3:57 am, Jon wrote: > I'm using slideUp and slideDown to animate a drop down menu. > > If i mouse on/off the menu in very quick succession the sliding up and > down animations stack up so that when you take your mouse away from it > it is still animating up and down. Is there any way to stop the > animation in the same way that you'd stop animate: > > $(".element").stop().animate(etc... > > If i use .stop() on slideDown/slideUp it stops the element from > expanding again beyond the size it was stopped at. I hope that makes > sense. > > Here is my code: > $(".ClientMenu").hover(function () { > $(".ClientMenuBody").slideDown("medium");}, > > function () { > $(".ClientMenuBody").slideUp("fast"); > > }); > > And HTML: > > > by client > > > Lorem Ipsum > width="150" height="2" /> > Lorem Ipsum > width="150" height="2" /> > Lorem Ipsum > width="150" height="2" /> > Lorem Ipsum > width="150" height="2" /> > Lorem Ipsum > width="150" height="2" /> > Lorem Ipsum > width="150" height="2" /> > Lorem Ipsum > width="150" height="2" /> > Lorem Ipsum > >
[jQuery] Re: failing miserably in IE
Turns out their was a newer version of the plugin which I downloaded and have now loaded up to the site. From what i can understand, that version uses the proper format you referred to. However, i am still getting the errors on jquery.min.js and main.js (which is google maps api). On Feb 24, 4:58 pm, pedalpete wrote: > Thanks MorningZ, > > strange that that is not the error I'm getting at all. > My errors have pointed a break in the jquery.1.3.1.min.js (which > seemed odd). > > I completely removed the references to dynacloud, but still get the > jquery and google maps errors. > > I've got the debugging on in IE, that's how i'm seeing the errors. > > I actually tried to fix the plugin to work with noconflict, (before > you saw it), but even with the link you sent, i am somewhat lost on > how to do that. > > I'll load up another version later today, but I'm finding this very > puzzling (and i actually had the problem before noconclict was turned > on. > > On Feb 24, 2:29 pm, MorningZ wrote: > > > In times like this, turning on Script Debugging in IE is very helpful > > (tools/options/advanced/uncheck-"disable script debugging") > > > pulling up the link above with debugging on pointed out the problem > > right away: > > > "Error: '$' is null or not an object" > > for the line > > if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { > > > looking at the code in "dynaCloud.js" > > > -- > > jQuery.fn.dynaCloud = function() { > > return this.each(function() { > > //var now = new Date().getTime(); > > > var cl = []; > > var max = 2000; > > var min = 10 > > > if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { > > var count = $.dynaCloud.max == -1 ? 50 : $.dynaCloud.max; > > -- > > > he didn't follow this convention > > >http://www.learningjquery.com/2007/10/a-plugin-development-pattern > > (scroll down to 'Keep private functions private', which makes sure > > that the code can use "$" even if "noConflict" is specified) > > > fix up that plugin script and you should be all good > > > On Feb 24, 4:56 pm,pedalpete wrote: > > > > So I got a version up and running, obviously you'll see by looking > > > this that it isn't a complete work, but if fails completely in IE, but > > > works in FF & Chrome. > > > >http://ec2-75-101-196-181.compute-1.amazonaws.com/v2/ > > > > I've picked it apart and put it back together, and it seems I just > > > keep ending up with different errors as I get deeper and deeper into > > > it, and the errors that are getting reported are with google maps, or > > > the the datePicker, or genre cloud. any ajax requests, etc. > > > Really any non-core (with the exception of ajax) function just doesn't > > > work. > > > > Any ideas on how to track this down would be greatly appreciated.
[jQuery] Re: failing miserably in IE
Thanks MorningZ, strange that that is not the error I'm getting at all. My errors have pointed a break in the jquery.1.3.1.min.js (which seemed odd). I completely removed the references to dynacloud, but still get the jquery and google maps errors. I've got the debugging on in IE, that's how i'm seeing the errors. I actually tried to fix the plugin to work with noconflict, (before you saw it), but even with the link you sent, i am somewhat lost on how to do that. I'll load up another version later today, but I'm finding this very puzzling (and i actually had the problem before noconclict was turned on. On Feb 24, 2:29 pm, MorningZ wrote: > In times like this, turning on Script Debugging in IE is very helpful > (tools/options/advanced/uncheck-"disable script debugging") > > pulling up the link above with debugging on pointed out the problem > right away: > > "Error: '$' is null or not an object" > for the line > if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { > > looking at the code in "dynaCloud.js" > > -- > jQuery.fn.dynaCloud = function() { > return this.each(function() { > //var now = new Date().getTime(); > > var cl = []; > var max = 2000; > var min = 10 > > if (typeof $.wordStats != 'undefined' && $.dynaCloud.wordStats) { > var count = $.dynaCloud.max == -1 ? 50 : $.dynaCloud.max; > -- > > he didn't follow this convention > > http://www.learningjquery.com/2007/10/a-plugin-development-pattern > (scroll down to 'Keep private functions private', which makes sure > that the code can use "$" even if "noConflict" is specified) > > fix up that plugin script and you should be all good > > On Feb 24, 4:56 pm, pedalpete wrote: > > > So I got a version up and running, obviously you'll see by looking > > this that it isn't a complete work, but if fails completely in IE, but > > works in FF & Chrome. > > >http://ec2-75-101-196-181.compute-1.amazonaws.com/v2/ > > > I've picked it apart and put it back together, and it seems I just > > keep ending up with different errors as I get deeper and deeper into > > it, and the errors that are getting reported are with google maps, or > > the the datePicker, or genre cloud. any ajax requests, etc. > > Really any non-core (with the exception of ajax) function just doesn't > > work. > > > Any ideas on how to track this down would be greatly appreciated.
[jQuery] Re: failing miserably in IE
So I got a version up and running, obviously you'll see by looking this that it isn't a complete work, but if fails completely in IE, but works in FF & Chrome. http://ec2-75-101-196-181.compute-1.amazonaws.com/v2/ I've picked it apart and put it back together, and it seems I just keep ending up with different errors as I get deeper and deeper into it, and the errors that are getting reported are with google maps, or the the datePicker, or genre cloud. any ajax requests, etc. Really any non-core (with the exception of ajax) function just doesn't work. Any ideas on how to track this down would be greatly appreciated.
[jQuery] return false not stopping the form submit
I've got a page where i submit a very similar form for ajax response multiple times. I had this working, and have now split this out so that the variables are retrieved in a function and returned in an object. Unfortunately, now that I've done that, the submit form seems to be ignoring the 'return false' statement, and is submitting the form, rather than running the function within the submit. [code] function getFormData(){ var formData = new Object; var searchAddress=jQuery('form#filterList input#searchTxt').val (); if (GBrowserIsCompatible()) { var geo = new GClientGeocoder(); geo.getLocations(searchAddress, function (result) { if(!result.Placemark){ jQuery('span#addressNotFound').text(''); } else { jQuery('span#addressNotFound').empty(); jQuery('span#headerLocal').text(searchAddress); formData.accuracy= result.Placemark [0].AddressDetails.Accuracy; formData.lat = result.Placemark[0].Point.coordinates [1]; formData.long = result.Placemark[0].Point.coordinates [0]; } }); } var date = new Date(); var d = date.getDate(); var day = (d < 10) ? '0' + d : d; var m = date.getMonth() + 1; var month = (m < 10) ? '0' + m : m; var year = date.getYear(); year=year+1900; forData.toDate=year+'-'+month+'-'+day; var range=jQuery('li.setDist').attr('id'); formData.dateRange = jQuery('.updateDate').attr('id'); } jQuery('form#filterList').submit(function(){ getFormData(); mapShow(formData.lat, formData.long, formData.accuracy, 'areaMap'); jQuery('div#holdForecast').empty(); jQuery('div#holdShows ul.showList').livequery(function(){ jQuery.ajax({ type: "GET", url: "processes/formatShows.php", data: "output=&genre="+formData.genre +"&numResults=30&date="+formData.toDate +"&dateRange="+formData.dateRange+"&range="+formData.range +"&lat="+formData.lat+"&long="+formData.long, success: function(response){ jQuery('div#holdShows ul.showList').html(response); } }); }); jQuery.ajax({ type: "GET", url: "processes/formatShows.php", data: "output=&type=forecast&genre="+formData.genre +"&numDays=4&numResults=5&date="+formData.toDate +"&dateRange="+formData.dateRange+"&range="+formData.range +"&lat="+formData.lat+"&long="+formData.long, success: function(response){ jQuery('div#popForecast').html(response); } }); return false; }); [/code] any idea why this would be? is there a better way I should be doing this? [/code]
[jQuery] Re: failing miserably in IE
Thanks James, that's actually how I got to the point of discovering where the broken bits were. I removed the javascript line by line until i got the errors to stop showing up. Unfortunately I'm getting to the point where there is so little on the page that it isn't even remotely resembling the original functions, and even now the simplest stuff is still not working. I've checked that all the libraries and packages are loading properly, and as I said, this is only a problem in IE. FF and Chrome work perfectly, so if it were a problem with the packages directly you'd think that FF and Chrome wouldn't work. I'll hopefully get to have a live page going later this week, but I was hoping their is a solution I could use today. On Feb 23, 11:31 am, James wrote: > It's hard to tell without a test page. I think you should work from > bottom up, even if you think it should all be working properly > together. Make sure that jQuery library is working correctly and one- > by-one add in the other things. Make sure that all your links to > external Javascript/CSS files are not broken. > > On Feb 23, 9:14 am, pedalpete wrote: > > > I'm not sure where to even start with this. > > I've got a page with a ton of scripts that I've basically copied from > > one of my other pages (which works fine in IE). > > > Of course, some of the scripts have changed, but I've got strange > > things failing everywhere. > > The common errors I was getting an 'undefined error in > > jquery-1.3.1.js' error, and i pinned it down to this bit of code > > > [code] > > $('span#datePickers').DatePicker({ > > flat: true, > > date: Date(), > > current: multiCalDate(), > > calendars: 3, > > mode: 'range', > > starts: 1, > > onChange: function(formated, dates){ > > var theseDates = dates.toString(); > > var splitRange= theseDates.split(','); > > var firstRSplit=splitRange[0].split(' '); > > var firstRange = [ > > firstRSplit[0], > > firstRSplit[1], > > firstRSplit[2], > > firstRSplit[3].length == 4 ? firstRSplit[3] > > : firstRSplit > > [5], > > '' > > ].join(' '); > > > var secondRSplit=splitRange[1].split(' '); > > var secondRange = [ > > secondRSplit[0], > > secondRSplit[1], > > secondRSplit[2], > > secondRSplit[3].length == 4 ? > > secondRSplit[3] : secondRSplit > > [5], > > '' > > ].join(' '); > > > if(firstRange==secondRange){ > > var dateRange=firstRange; > > } else { > > var dateRange = firstRange+' to '+secondRange; > > } > > jQuery('.updateDate').html(dateRange); > > jQuery('.updateDate').attr('id',formated) > > }}); > > > [/code] > > > again, i don't know why this is, and this code works without issue. > > > So I removed this bit of code, and now I can get the page to load, but > > my trying to make an ajax request with > > > [code] > > jQuery('div#holdShows ul.showList').livequery(function(){ > > jQuery.ajax({ > > type: "GET", > > url: "processes/formatShows.php", > > data: "output=&genre="+genre+"&numDays="+numDays > > +"&numResults="+numResults+"&date="+toDate+"&dateRange="+dateRange > > +"&range="+range+"&lat="+lat+"&long="+long, > > success: function(response){ > > alert(response); > > jQuery('div#holdShows ul.showList').html(response); > > } > > }); > > }); > > [/code] > > > does not launch the alerts, at all. > > Of course, running this page in FF or Chrome results in no errors and > > everything runs smoothly. > > > I've been at this for days trying to get it to work. > > Please, please, please!!! How would you go about working through this? > > > I'm using debugbar in IE for debugging. I'm on Vista Home version, so > > the debugging tools are limited. > > Thanks, > > Pete
[jQuery] failing miserably in IE
I'm not sure where to even start with this. I've got a page with a ton of scripts that I've basically copied from one of my other pages (which works fine in IE). Of course, some of the scripts have changed, but I've got strange things failing everywhere. The common errors I was getting an 'undefined error in jquery-1.3.1.js' error, and i pinned it down to this bit of code [code] $('span#datePickers').DatePicker({ flat: true, date: Date(), current: multiCalDate(), calendars: 3, mode: 'range', starts: 1, onChange: function(formated, dates){ var theseDates = dates.toString(); var splitRange= theseDates.split(','); var firstRSplit=splitRange[0].split(' '); var firstRange = [ firstRSplit[0], firstRSplit[1], firstRSplit[2], firstRSplit[3].length == 4 ? firstRSplit[3] : firstRSplit [5], '' ].join(' '); var secondRSplit=splitRange[1].split(' '); var secondRange = [ secondRSplit[0], secondRSplit[1], secondRSplit[2], secondRSplit[3].length == 4 ? secondRSplit[3] : secondRSplit [5], '' ].join(' '); if(firstRange==secondRange){ var dateRange=firstRange; } else { var dateRange = firstRange+' to '+secondRange; } jQuery('.updateDate').html(dateRange); jQuery('.updateDate').attr('id',formated) } }); [/code] again, i don't know why this is, and this code works without issue. So I removed this bit of code, and now I can get the page to load, but my trying to make an ajax request with [code] jQuery('div#holdShows ul.showList').livequery(function(){ jQuery.ajax({ type: "GET", url: "processes/formatShows.php", data: "output=&genre="+genre+"&numDays="+numDays +"&numResults="+numResults+"&date="+toDate+"&dateRange="+dateRange +"&range="+range+"&lat="+lat+"&long="+long, success: function(response){ alert(response); jQuery('div#holdShows ul.showList').html(response); } }); }); [/code] does not launch the alerts, at all. Of course, running this page in FF or Chrome results in no errors and everything runs smoothly. I've been at this for days trying to get it to work. Please, please, please!!! How would you go about working through this? I'm using debugbar in IE for debugging. I'm on Vista Home version, so the debugging tools are limited. Thanks, Pete
[jQuery] Re: .click to start dropdown, hover out to clear (mixing the two)
Ok, actually got this working with the following code [code] $('form#filterList span.holdDate').click(function(){ $('span#datePickers, div.datepicker').slideDown('fast'); $('span#datePickers, div.datepicker').hover( function(){}, function(){ $('div.datepicker').slideUp('slow'); }); }, function(){ }); [/code]
[jQuery] Re: .click to start dropdown, hover out to clear (mixing the two)
right, so does that mean their is no way to specify only the hover out in jquery? On Feb 17, 6:21 pm, James wrote: > The syntax for hover() is hover(function, function), where the first > function is what happens when something is onmouseover and the second > is onmouseout. > > $(elem).hover( > function() { > // do something on mouseover > }, > function() { > // do something on mouseout > } > ); > > On Feb 17, 1:07 pm, pedalpete wrote: > > > I've got a fairly simple form with a few dropdowns which I currently > > trigger on hovers. > > > A use requested that instead of a hover, that the dropdowns be > > triggered by a click event. > > No problem, except that I need the dropdown to slideUp when the user > > hovers out. > > > I've taken a look at the .hover documentation, but can't seem to > > figure out how to specify the 'out' (though it does say that this > > exists). > > > Here's the code I've got now > > > [code] > > $('form#filterList span.holdDate').click(function(){ > > $('span#datePickers, div.datepicker').slideDown('fast'); > > > }, > > $('span#datePickers').hover('out', function(){ > > $('#datePickers').slideUp('slow'); > > }); > > }); > > [/code] > > > unfortunately, i'm getting an error when running this function. I > > figure it is more efficient to only run the 'hover' code within > > the .click function, but maybe that isn't right.
[jQuery] .click to start dropdown, hover out to clear (mixing the two)
I've got a fairly simple form with a few dropdowns which I currently trigger on hovers. A use requested that instead of a hover, that the dropdowns be triggered by a click event. No problem, except that I need the dropdown to slideUp when the user hovers out. I've taken a look at the .hover documentation, but can't seem to figure out how to specify the 'out' (though it does say that this exists). Here's the code I've got now [code] $('form#filterList span.holdDate').click(function(){ $('span#datePickers, div.datepicker').slideDown('fast'); }, $('span#datePickers').hover('out', function(){ $('#datePickers').slideUp('slow'); }); }); [/code] unfortunately, i'm getting an error when running this function. I figure it is more efficient to only run the 'hover' code within the .click function, but maybe that isn't right.
[jQuery] Re: click events on links
i've done this before just leaving out the href in the a tag. if you aren't going to use it, you may as well not put it in. On Feb 14, 5:48 pm, introvert wrote: > Hello. > > I have a simple anchor href link on which I put on click event > handler: > > > $("#pause").click(function () { > //do something > > }); > > When I click the link the action will be preformed and the browser > would scroll to the top of the page (because of # in the href > attribute). How do I prevent that? > > Thanks for help!
[jQuery] strange loop with livequery click
I've got a page that I'm loading via ajax, and the first time I load the page, the click function works great. If I make a second ajax request and load new data, the clicks are triggering the function twice. Even though I empty the div before loading the new data, and then call livequery on the click. Any idea why livequery would do this, and what the solution would be? [code] function loadForecast(lat, long){ $('div#holdForecast').empty(); var i=1; $.ajax({ type: "GET", url: "widgets.php", data: "lat="+lat+"&long="+long, success: function(response){ $('div#holdForecast').html(''+response+''); }); $("li.reItem").livequery('click', function(event){ alert(i); i++; } [/code] when I run this code, the alert shows (1) if i've only run the loadForecast function once. but if I get a second loadForecast function, then the alert shows the number of times I've called the funciton (2 or more). So that is how I'm figuring that the 'click' function is being called more than once per click. Other alerts further down in the code also get called multiple times as a result of the click.
[jQuery] Re: simple getting elements from ajax response not working
Hi Mike, yes, the response is an html with just a bunch of li's with a bunch of other within each li. On Feb 14, 3:40 pm, Mike Alsup wrote: > > The 'html(response) gets filled with ther response, but I can't get > > either html or attribute id from the li. > > The response has 10 li's, so I'm trying to get all of them, but > > figured I would do an 'each' or something if I could just manage to > > grab one. But I can't get that work? > > Is there something wrong with my code? > > Here's the code I've got > > [code] > > success: function(response){ > > var bidDate=$('li.show', response).attr('id'); > > alert(bidDate); > > $('div.#holdForecast').html(response); > > [/code] > > What is 'response'? Is it XML? HTML? A document? A fragment? > > If it's an HTML fragment what does it look like? Just a bunch of LIs?
[jQuery] simple getting elements from ajax response not working
I've got what should be a very simple script, but I can't seem to get anything but 'null' or 'undefined' when trying to get an elements html or id. The 'html(response) gets filled with ther response, but I can't get either html or attribute id from the li. The response has 10 li's, so I'm trying to get all of them, but figured I would do an 'each' or something if I could just manage to grab one. But I can't get that work? Is there something wrong with my code? Here's the code I've got [code] success: function(response){ var bidDate=$('li.show', response).attr('id'); alert(bidDate); $('div.#holdForecast').html(response); [/code]
[jQuery] Re: How do I update this with ajax??
I think the problem is that you have "return window.location.href (...)" I believe javascipt/jquery is understanding that as - onclick datepicker, go to href. If you want to get that href via ajax you have to create an ajax function you could do [code] $("#myDatePicker").datepicker({ onSelect: function(date) { var url=window.location.href("/Admin/Schedule/?date=" + date; $.ajax({ url: url, type:"GET", success: function(response){ // whatever you want to do with the response } }); }); [/code]
[jQuery] Re: How do I update this with ajax??
without seeing your jquery, it's tough to say exactly what is going on, but have you got 'return false;' at the end of your select function? That stops the page from submitting (refreshing). On Feb 10, 5:32 pm, AndreMiranda wrote: > Hi!! > > I have a page with DatePicker and a list of events that occur in some > respective date. So, when a person selects a date in DatePicker, this > date is passed as an argument to a method (I'm using asp.net mvc) and > this method returns me all the events of the chosen date. > > The problem is the page refreshes every time this process is done. > > So, what's the best way to make this via Ajax?? $.ajax.get?? > $.ajax.post?? What do you recommend? > > And how can I when update this list events of my page?? > > Thanks in advance!! > > André
[jQuery] Re: Another Slide Effect?
two things 1) posts to the forum don't show up immediately (not sure why, but sometimes it takes some time) 2) i think you are looking for the slideDown http://letmegooglethatforyou.com/?q=jquery+slide+down On Feb 10, 1:18 pm, "Clemens K." wrote: > (hope this time the posting works) > > hi. > > recently i transfered to jQuery from mootools. some time ago i made a > slide-down div with mootools and wanted to get a similar effect with > jQuery. > > example:www.madison.at-> click on login! > > is there a way or a plugin in jQuery, to get the whole box slide down > at once instead of slide down part by part? > > thanks in advance. > > best. > c.
[jQuery] animate the top of a div before the bottom
I'm trying to get an animation effect similar to opening a application on mac, where the top of the div will animate first, followed by the bottom of the div. Top of the div gets wider, and tapers to the bottom and then the bottom half animates to match. Has anybody seen this before? The div has a repeated background image and border, so splitting it into two divs and animating one and then the other won't work (i don't think). Any ideas?
[jQuery] Re: Convert from AjaxRequest to jQuery/ajax
Sorry Tim, I didn't understand it that way. You should still be able to do this fairly simply. You don't have to specify the url, you can pass it as a variable. But you would need to put your $.ajax function into another function, and call it when clicked. You can also build the data variables in the other functions. For instance [code] $('form#1').submit(function(){ var url=$('form#1).attr('action'); // then get your data variables and do whatever you want to do with them var type= "get"; submitForm(url, data); }); function submitForm(url, data){ $.ajax({ type: type, url: url, data: data, success: function(){ } }) } [/code] I hope that helps, and that I understand what you were trying to do better than my first answer.
[jQuery] Re: Convert from AjaxRequest to jQuery/ajax
I believe the code you are looking for would be something like this [code] $('form').submit(function(){ var cell1 = $('#cell1').html(); var div1= $('#div1").html(); var span1=$('#span1").html(); $.ajax({ type: "GET", url : 'urlToGet.php', data: 'cell1='+cell1+'&div1='+div1+'&span1='+span1, success: function(response){ // whatever you want to do with the response } }); }); [/code] On Feb 8, 4:23 pm, Tim Johnson wrote: > For some time I've been using a little ajax library called AjaxRequest. > Because I'm working with code generation tools, I'd like to make a > first - step switch to jQuery as simple as possible. > A sample AjaxRequest function follows: > function CheckForm0(theform) { > AjaxRequest.submit( > theform > ,{ > 'onSuccess':function(req){ > var res = req.responseText.split('\n') > document.getElementById("cell1").innerHTML = res[1]; > document.getElementById("div1").innerHTML = res[2]; > document.getElementById("span1").innerHTML = res[3]; > alert(res[0]); > }, > 'onError':function(req){ alert("ERROR: " + req.statusText);} > } > ); > return false; > } // end function > // Form tag follows: > action="http://bart.johnson.com/cgi-bin/baker/reb/test-ajax.r"; > onsubmit="return CheckForm0(this);"> > // Note that method, action, and onsubmit parameters are in the tag > // and I would prefer that they remain there. Also the form is referenced > // by 'this' in the onsubmit parameter and passed to the Ajax function. > > I'd appreciate pointers to jQuery examples that would help me with the > transition. I'd like an approach that requires as few changes to the form > tag as possible. > > Thanks > Tim
[jQuery] reloading new objects from json
I've got a ajax request that grabs a json response. In order to be able to sort and get data from the response, I put the response into a few objects using [code] function(jsondata){ var dates={}; var ids={}; $.each(jsondata.entry, function(){ if(!ids[this.id]) ids[this.id] = []; ids[this.id].push(this); if(!dates[this.date]) dates[this.date] = []; dates[this.date].push(this); }); for(var d in dates){ var date=d; $('div#holddates').append(''+date+''); $.each(dates[date], function(){ $('ul#'+date).append(''+this.name+''); }); } [/code] When a user clicks on one of the dates, i go back to the json and get a location from the id object [code] $('li.show').livequery('click', function(){ var getSid=$(this).attr('id'); alert(getSid); $.each(bids[getSid], function(){ alert(this.name); }); }); [/code] All of this code works the first time I get an ajax response, however, if I make another ajax request, the first portion loads (so I get the list with the id and name), but if I click that name, I seem to not get access to the object again. The first alert does show the correct id is being clicked, but I can't seem to get past that. Whats I found very strange is that if I pass the object into the livequery function, then it always fails, even on the first response.
[jQuery] Re: traversing ajax response with .find in Safari/Chrome
like my original statement that works in IE and FF, but not Safari or Chrome. Strange On Feb 6, 11:17 pm, jQuery Lover wrote: > var newItem=$("div#item", response).html(); > > > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > On Sat, Feb 7, 2009 at 9:02 AM, pedalpete wrote: > > > I'm trying to get a div from an html ajax response. > > my code is pretty simple > > > [code] > > success: function(response){ > > > var > > newItem=$(response).find("div#item").html(); > > > alert(newItem); > > } > > [/code] > > > This works fine in FF and IE, but Chrome and Safari both return null. > > > I'm trying to find another way to write that, but It all seems pretty > > straight forward to me. > > Is there another way to get this other than .find?
[jQuery] Re: jquery, ajax, and search engines
Search engines don't see dynamic content. You can put some content in a noscript tag, and that will be visible to a search spider, and anybody who doesn't have javascript (enabled). On Feb 7, 7:06 am, jhm wrote: > I've noticed when I fill in dynamic content on a page using jquery > that when you view source you don't see the dynamic content. So I'm > wondering if search engines don't see it as well. It's obviously a > serious consideration. > > Thanks!
[jQuery] traversing ajax response with .find in Safari/Chrome
I'm trying to get a div from an html ajax response. my code is pretty simple [code] success: function(response){ var newItem=$(response).find("div#item").html(); alert(newItem); } [/code] This works fine in FF and IE, but Chrome and Safari both return null. I'm trying to find another way to write that, but It all seems pretty straight forward to me. Is there another way to get this other than .find?
[jQuery] ajax submit val() not submitting updated data
Hi all, I've been working with this page for a while, and I can't seem to figure out the problem (it's running locally as it is just a tool for me to try to fix up some data). Basically what I have is a page that looks at the user submitted data. The data is in a input box - but for simplicity it is not in a form. This way if I need to update the data, I can just change it in the input field and click the link and it updates the field via ajax. The problem is that when I update the input field, and then click the accept, the data that is being returned isn't the changed data, but the original data. The jquery i am using looks like this [code] $('.button').click(function(){ var update = $(this).attr('id'); var thisEntry = $(this).parent('#thisList').html(); var updatedEntry = $(thisEntry+'input.name').val(); alert(updatedEntry); var id = $(thisEntry+'.name').attr('id'); $.ajax({ type: 'POST', url: 'fixing.php', data: 'name='+updatedEntry+'&id='+id, success: function(response){ $('.'+id).fadeOut('slow'); } }); }); [/code]
[jQuery] Re: Changing query parameter
I'm not sure what you bean about changing depending on 'where I'm using the plugin'. you could use an if statement to set the parameter to change. for instance [code] if(q=='foo'){ var term=q; } if(term==null){ term=q; } [/code] something like that I think, but you haven't really spelled out what you are trying to do . On Nov 28, 12:33 am, Osymandias <[EMAIL PROTECTED]> wrote: > Hi all, > > Wondering how to change the actual query parameter sent by jquery at > run time: e.g. instead of > > services?q=foo > > I might want to do > > services?term=foo, > > and this will change depending on where I'm using the plugin.
[jQuery] Re: ajax post variable error in safari/chrome
figured this one out a while ago, but forgot to update it (though it took forever to debug too). Turns out it wasn't really webkit (though the other websites didn't have a problem), but spaces in the text were being represented by /\W\g, and only webkit did not strip this out when posting the data. Other browsers did strip it out. On Nov 27, 3:20 pm, rodrigopolo <[EMAIL PROTECTED]> wrote: > WebKit sucks parsing Dynamic XML, I had this problem and I found it was > because Gzip... > > The SOLUTION in PHP, add the fallowing code in your PHP code: > > header('Content-Type: application/xml'); > ob_start('ob_gzhandler'); > > another problem reasons could be that your dynamic XML is not a real XML, my > advice for tests: > > Use Firefox and Firebug > save your dynamic XML in the same dir where is your dyamic one > open both, the dynamic and the saved on firefox > check if the headers look the same > > good luck. > > > > pedalpete-2 wrote: > > > I know this is kinda weird, and I can't seem to find where the issue > > is. > > > i've been working on a tag cloud for my site hearwhere.com and > > everything works from FF/IE, but safari and chrome won't let me pass a > > multi-word variable into my query. > > > You can test it out athttp://zifimusic.com/v3 > > > The single word genres from the tag cloud work no problem, but the > > multi-words (like 'folk rock') always return 0 results in Safari/ > > Chrome but return a number of results in FF/IE. > > > I've output the query and copied it from source, and it runs fine, so > > I don't understand how Chrome & Safari could be causing this issue, > > but everything seems to be going in correctly. > > > I've left an 'alert' on the passed genre so I can see what is being > > passed, and it all looks good to me. > > > ANY ideas on this? > > Super strange (i think). > > -- > View this message in > context:http://www.nabble.com/ajax-post-variable-error-in-safari-chrome-tp198... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: animation conflicts - cycle/other in IE
Thanks Mike (and sorry about getting your name wrong, not sure how i managed that). You are correct of course, I changed the settings to timeout: 1, speed: 2000, and response time is much better in IE. I'll check it on lower powered computers to make sure I am being more responsible with CPU usage. Thanks again, Pete On Nov 17, 4:58 pm, Mike Alsup <[EMAIL PROTECTED]> wrote: > > $('div.allPops').cycle({ > > cleartype: 1, > > timeout: 5000, > > speed: 3200, > > pager: 'div#pager', > > fx: 'fade', > > pause: 1, > > pauseOnPagerHover: 1}); > > You are crushing the CPU with those settings. Best case scenario, > you're asking the browser to perform an opacity animation for 3.2 > seconds out of every 5. That is just not a good idea and not a > responsible use of your visitors CPU. Even though the response in > non-IE browsers is ok, take a look at your CPU usage when that page is > loaded! > > Mike
[jQuery] animation conflicts - cycle/other in IE
I recently added David Malsup's Cycle plugin to my site, and I love the functionality it provides. However, i noticed that some animations/events where responding REALLY slowly in IE. I started pulling things out of the page to see what was causing the slowdown, and from what I can tell, it's the cycle plugin causing the problems (only in IE, site seems good in FF/Safari/Chrome). To see the problem, you can go to http://zifimusic.com/slowIE/ The cycle plugin runs, but try hovering over any of the form fields (Genre, Date, Distance) and those dropdowns just take forever to get triggered (it appears as though they don't get triggered at all, but wait long enough, and they will drop down. The dropdowns use 'hoverIntent' (Genre, Date) and 'superfish' (distance) to trigger the dropdown. I have noticed everything else responding a bit slower, but those are the real 'showstoppers' on this one. I've tried pausing the cycle on hover, but that didn't seem to have the desired effect. Any ideas on this one? Here's the code I use for the hovers and the cycle in case it helps [code] $('form#filterList span.holdDate').hoverIntent(function(){ $('span#datePickers, div.datepicker').slideDown('fast'); }, function(){ $('#datePickers').slideUp('slow'); }); $('form#filterList span.genreblock').hoverIntent(function(){ $('span#dynacloud').slideDown('fast'); var thisDynacloud=$('span#dynacloud').html(); if(thisDynacloud==''){ $('div#left div#thiscloud').dynaCloud(); } }, function(){ $('span#dynacloud').slideUp('slow'); }); $('form#filterList ul.nav').superfish(); $('div.allPops').cycle({ cleartype: 1, timeout: 5000, speed: 3200, pager: 'div#pager', fx: 'fade', pause: 1, pauseOnPagerHover: 1 }); [/code] Any suggestions on would be greatly appreciated, Pete
[jQuery] Re: jCarousel pagination with numbers?
I was looking for a similar set-up and went with the Dave Malup's cycle plug-in as it handles the paging. Should be easier to add next/prev arrows to that plugin rather than add paging to a carousel. http://malsup.com/jquery/cycle/ I didn't need back/forward, so I haven't needed to build that in, but the plugin has a next and prev function. On Nov 17, 6:38 am, matt <[EMAIL PROTECTED]> wrote: > Has anyone developed a way to (along with the next/previous arrows) > have the number of images below. for example previous 1 2 3 4 5 > next ? And then if you click on number 3, it would should the 3 image > inside the carousel view area? I'm looking at this > example:http://sorgalla.com/projects/jcarousel/examples/static_auto.html > > I would like to do one at a time (which you can do via the settings), > but how do you add numbers so that clicking on one will move it to > that direct image?
[jQuery] Re: how to fade in newly dom created content?
I've been having a similar issue with sliding an element to be visible after adding it to the dom. I think the problem is that your class is visible, and therefore it will just show-up, rather than fade in which you are doing after. Have you tried setting the visibility of messages to hidden, and then fade it in? On Nov 12, 10:31 am, sqad <[EMAIL PROTECTED]> wrote: > $('#messages').after('something nice div>').fadeIn(5); > > Umm, should this work? I am basiclaly trying to add elements to the > #messages div but fade them in slowly after each addition. Any help is > appreciated.
[jQuery] Re: Cycle Plug-in works with ajax on first call, not on subsquent calls
My apologies Mike, I am using firebug with Firefox, and hadn't seen that error in quite a while, I then realized that from my first post on this subject to when you re-requested the url, I had re-introduced the error on the testing site. Now combining the fix with stopping and emptying the cycle, it all seems to be working. Thanks Mike, this plug-in is awesome! On Nov 5, 4:14 am, Mike Alsup <[EMAIL PROTECTED]> wrote: > > Thanks Mike, here's the link and a description of how to get it to not > > work.. > > >http://zifimusic.com/cycle > > I'm guessing that you're not using Firefox with Firebug. If you were, > you could set a breakpoint and see that your 'allPops' div contains > only a single element after the ajax call, so the markup is not as you > expect when you callcyclethe 2nd time. In addition,cyclelogs this > message: > > [cycle] terminating; too few slides: 1 > > Mike
[jQuery] Re: Cycle Plug-in works with ajax on first call, not on subsquent calls
Thanks Mike, here's the link and a description of how to get it to not work.. http://zifimusic.com/cycle The cycle loads perfectly the first time (you see it load after a few seconds - it will say 'feature artists' , and that will scroll through the cycle). Then, if you filter the list of results with the 'find shows' button (select a different city, or genre, or dates), the shows will reload, and the featured shows will show-up, but the cycle doesn't start. The code which loads the 'feature artists' is the $ ('div#popList').html(response), but the upcoming artists is also loaded with the response code. On Nov 4, 4:50 pm, Mike Alsup <[EMAIL PROTECTED]> wrote: > > I had assumed that stopping the 'cycle' would clear it and allow me to > > reassign it, but apparently that isn't working. > > > I've tried > > [code] > > $('div.allPops').cycle('stop'); > > $('div#popList').empty(); > > $('div#popList').html(response); > > wrapPopShows(); > > [/code] > > > Thinking that would 'reset' the cycle to the initial state. > > I've also tried using livequery with cycle, that is erroring out on > > the cycle attributes. > > Can you post a link that shows the problem you're having?
[jQuery] Re: Cycle Plug-in works with ajax on first call, not on subsquent calls
Thanks Mike, I had assumed that stopping the 'cycle' would clear it and allow me to reassign it, but apparently that isn't working. I've tried [code] $('div.allPops').cycle('stop'); $('div#popList').empty(); $('div#popList').html(response); wrapPopShows(); [/code] Thinking that would 'reset' the cycle to the initial state. I've also tried using livequery with cycle, that is erroring out on the cycle attributes. On Nov 4, 12:37 pm, Mike Alsup <[EMAIL PROTECTED]> wrote: > > Any idea on how to stop/remove the cycle function and then restart it? > > To stop: > $('#mySlideshow').cycle('stop'); > > To restart (same as first start): > $('#mySlideshow').cycle([ > // your options here > > });
[jQuery] Re: Show/Hide. Could someone, please, help me with this?
Should be pretty simple Miguel. The first thing I would do is add an ID to each legend and/or image you want to trigger the show so you can tell which one has been clicked and add a common class to all the legends and images. Then put the id as a class of the fieldset you would like to show/ hide. Finally, I'd use the .toggle function of jquery, so like this [code] $('.CLASSNAME').clicke(function(){ var whichOne = $(this).attr('id'); $('.'+whichOne).toggle(); }); [/code] that should do it. On Nov 4, 10:47 am, shapper <[EMAIL PROTECTED]> wrote: > Hello, > > I have a form as following: > > > > Personal Data > > > > Options > > > > > I would like to hide/show each fieldset when its legend is clicked ... > ... or even better, adding a small icon on legend or somewhere in > fieldset to toogle visibility. > > How can I do this with JQuery? > > Thanks, > Miguel
[jQuery] Cycle Plug-in works with ajax on first call, not on subsquent calls
Hey jqueriers! I've been working on implementing a carousel on my live music site HearWhere so that I can scroll through popular shows. After playing with a few different plug-ins, I settled on the AMAZING cycle plugin by Mike Alsup. I've got the cycle working on my dev site http://zifimusic.com/cycle I load the cycle first via ajax and it works perfectly. However, using the same code on subsequent ajax calls does not work, even if I use .empty() to remove the current carousel items. the code I use is pretty simple [code] $('div#popList').html(response); wrapPopShows(); function wrapPopShows(){ $('div.allPops').cycle({ cleartype: 1, timeout: 3000, speed: 900, pager: 'div#pager', fx: 'scrollUp' }); } [/code] I don't believe I can use the standard 'callback' function, as data which is returned in 'response' is a large list of shows, only some of which end up in the cycle, the rest are shows statically, as well as a bit more data. I am trying to avoid making more than one ajax call when a user gets a results page (which is loaded by ajax). Any idea on how to stop/remove the cycle function and then restart it?
[jQuery] Re: Selecting option of select with different ID using same code
Not sure if I understand, but you can't add an id to the links? is that correct? Any chance you can have your links read "Select option with Blue text" ? That way you could use the .html() selector to get the value of the clicked item and feed that into your "("#productImg" + optionValueText).show();" function. otherwise, you can use .click() to grab the .htm() and then strip out the bits you don't need ("select", "options', etc). Though this is not as nice a way to do it. On Oct 28, 9:25 am, Franky <[EMAIL PROTECTED]> wrote: > Please take a look on example code: > > > jQuery(document).ready(function() { > jQuery("#imageShowcase img").hide(); > jQuery("#productImgDefault").show(); > jQuery("#colorSelector").change(function() { > // Hide all images on slect element change action > jQuery("#imageShowcase img").hide(); > // Get the value of selected option > var optionValue = jQuery(this).attr('value'); > // Just a test to see if you're getting option value > // alert(optionValue); > // Get the content (aka inner HTML) of selected option > var optionValueText = jQuery.trim(jQuery('#colorSelector dl > dd.last select :selected').text()); > // Just a test to see if you're getting right selected option > inner text > // alert(optionValueText); > //alert('Selected option has value: ' + optionValue + ' and > inner text: ' + optionValueText); > // Show the image based on selected value > jQuery("#productImg" + optionValueText).show(); > });}); > > > > > Color Group * label> > > > -Select- > Blue > Blue-Green > Green > Grey-Black > Pink-Purple > Red > White > Yellow-Brown > > > > > > alt="image missing" /> > > style="display:none;" /> > > alt="" style="display:none;" /> > > > title="Yellow image" alt="" style="display:none;" /> > style="display:none;" /> > alt="" style="display:none;" /> > title="Yellow image" alt="" style="display:none;" /> > > > This code changes image depending on the option selected in select. > I'm using very long code without ID used to get select option (aka > #colorSelector dl dd.last select) because code used on Magento and it > assigned for each select different ID and name. > > My question is. It that possible to make code to change images in the > same way, but using link like: > select option with Blue text > > Thanks for help!
[jQuery] slideDown with append
I'm sure this one is super simple for a bunch of people, but I'm a bit stuck. I have a list of items (show listings) and when a user clicks on a show, I want a map to slideDown and display a map of the location of the show. If the user clicks on another show, the map that is being shown slides in, and the new one slideDown. Very similar to an accordian, but my initial markup isn't as simple. What I thought I could do was to just append the show listing with the html to hold the map, and then call the slideDown function. But what i have is just the whole map popping out. I believe this is because I have to give the map a size before I can show it (google map). I've tried wrapping the map in another div and tried playing with the height that wrapper div, but that didn't really work either. Here's the code I've got working right now. [code] $(".show").livequery('click', function(event){ $('a.active').removeClass('active'); $('div.holdExtras').slideUp('slow').remove(); $(this).addClass('active').slideDown('slow').append('this holds player'); }); [/code] the slideUp & remove somewhat surprisingly works quite well, just the slideDown is giving me some problems. Thanks, Pete
[jQuery] Re: thickbox breaking other javacript functions
Looks like this might not have been a Thickbox issue in the end. The flash which I was loading i think was doing some strange things to javascript. I resolved it by using an iframe with thickbox instead of ajax. On Oct 23, 1:40 pm, pedalpete <[EMAIL PROTECTED]> wrote: > I've been working on implementing thickbox into my site, and I can > launch the thickbox no problem, and the site works (all the javascript > functions don't have a problem) before launching thickbox. > However, once I launch thickbox, javascript functions that worked > previously, no longer work. > > The link which opens the thickbox is part of an ajax page. > So (it's kinda a long way to get to it). > 1) go to this linkhttp://ZiFiMusic.com/thickbox > 2) when the page loads a list of artists, select an artist > 3) the page will load that artists page via ajax. - if you were to > select another artist, everything would load fine > 4) in the 'upcoming ARTIST NAME shows' section (just below the music > player), there is a link to 'get & share the artists shows widget' - > clicking that will launch the thickbox and load the widgets. > 5) now closing the thickbox and selecting an artist breaks the script > in multiple places. this does not break before thickbox is loaded. > > Any ideas on why this would be happening?
[jQuery] thickbox breaking other javacript functions
I've been working on implementing thickbox into my site, and I can launch the thickbox no problem, and the site works (all the javascript functions don't have a problem) before launching thickbox. However, once I launch thickbox, javascript functions that worked previously, no longer work. The link which opens the thickbox is part of an ajax page. So (it's kinda a long way to get to it). 1) go to this link http://ZiFiMusic.com/thickbox 2) when the page loads a list of artists, select an artist 3) the page will load that artists page via ajax. - if you were to select another artist, everything would load fine 4) in the 'upcoming ARTIST NAME shows' section (just below the music player), there is a link to 'get & share the artists shows widget' - clicking that will launch the thickbox and load the widgets. 5) now closing the thickbox and selecting an artist breaks the script in multiple places. this does not break before thickbox is loaded. Any ideas on why this would be happening?
[jQuery] Re: what is the best way to do this
I don't think you can 'get' class attributes (though you could try $ ('div').attr('class');). I you can get the ids. I set the id and then use jquery search class so if you had [code] [/code] etc. you could get the divs by using [code] $('div.profile').attr('id'); [/code]
[jQuery] ajax post variable error in safari/chrome
I know this is kinda weird, and I can't seem to find where the issue is. i've been working on a tag cloud for my site hearwhere.com and everything works from FF/IE, but safari and chrome won't let me pass a multi-word variable into my query. You can test it out at http://zifimusic.com/v3 The single word genres from the tag cloud work no problem, but the multi-words (like 'folk rock') always return 0 results in Safari/ Chrome but return a number of results in FF/IE. I've output the query and copied it from source, and it runs fine, so I don't understand how Chrome & Safari could be causing this issue, but everything seems to be going in correctly. I've left an 'alert' on the passed genre so I can see what is being passed, and it all looks good to me. ANY ideas on this? Super strange (i think).
[jQuery] Re: why is this code inefficient?
Thanks Karl, Not sure why i had never done that before, but now I'm going through my code and adding the appropriate starting tag throughout my jquery. This did speed things up quite a bit. On Sep 24, 2:56 pm, "Karl Rudd" <[EMAIL PROTECTED]> wrote: > For a start try using $('div.divideDate'). This means that jQuery can > just check "div" elements for the divideDate class rather than every > element on the page. > > Karl Rudd > > On Thu, Sep 25, 2008 at 5:01 AM, pedalpete <[EMAIL PROTECTED]> wrote: > > > I thought I was getting the hang of jquery and javascript, but then i > > wrote this small function, and it is really taking a long to run - > > like 15+ seconds. > > > The purpose of the function is that i have a list of concerts ordered > > by date. > > I want to show the date when the date changes, so for all concerts on > > Wed, Sep 24, I show the date as a heading on the first concert, and > > then hide the rest of the date headings, and then for concerts on Thur > > Sep 25, the date shows again on the first item, so users know they are > > looking at a different day. > > > This way users get a clear division of dates. > > > the function I'm using is > > [code] > > function showDateDivides(){ > > $('.divideDate').livequery(function(){ > > var dividedID = $(this).attr('id'); > > var dateTable = $('#'+dividedID).html(); > > var splitDateTable = dateTable.split(' '); > > var dayOfWeek = splitDateTable[0]; > > var numOfMonth = splitDateTable[1]; > > $('.dateTable#'+dividedID+':first').show(); > > $('.dateTable#'+dividedID+':first > > td#'+dayOfWeek).html(numOfMonth).addClass('firstDate'); > > }); > > [/code] > > > the class divideDate is hidden in the css when the page loads, > > The id holds the date formated in -mm-dd > > the class dateTable holds a weekly view date table (so 7 squares), and > > then the day of the week gets the date number and class of firstDate > > added to it. > > > I hope that's clear. Is this really inefficient code?
[jQuery] why is this code inefficient?
I thought I was getting the hang of jquery and javascript, but then i wrote this small function, and it is really taking a long to run - like 15+ seconds. The purpose of the function is that i have a list of concerts ordered by date. I want to show the date when the date changes, so for all concerts on Wed, Sep 24, I show the date as a heading on the first concert, and then hide the rest of the date headings, and then for concerts on Thur Sep 25, the date shows again on the first item, so users know they are looking at a different day. This way users get a clear division of dates. the function I'm using is [code] function showDateDivides(){ $('.divideDate').livequery(function(){ var dividedID = $(this).attr('id'); var dateTable = $('#'+dividedID).html(); var splitDateTable = dateTable.split(' '); var dayOfWeek = splitDateTable[0]; var numOfMonth = splitDateTable[1]; $('.dateTable#'+dividedID+':first').show(); $('.dateTable#'+dividedID+':first td#'+dayOfWeek).html(numOfMonth).addClass('firstDate'); }); [/code] the class divideDate is hidden in the css when the page loads, The id holds the date formated in -mm-dd the class dateTable holds a weekly view date table (so 7 squares), and then the day of the week gets the date number and class of firstDate added to it. I hope that's clear. Is this really inefficient code?
[jQuery] Re: datepicker plugin: question regarding date range
I've just started using the javascript .addMonth(1) function for adding a month to the selected date. It is working flawlessly so far. I took a look for a subtractDay() function, but haven't found much. Apparently you can use a php type date function in javascript [code] d = new Date(d.getYear(),d.getMonth(),d.getDate()+90) [/code] This page gives a bunch of info on manipulating dates in javascript. As far as I've seen there isn't a simple jquery-esque way of manipulating dates, but you can easily mix both jquery and javascript. http://bytes.com/forum/thread150917.html Hope it helps, Pete On Sep 23, 10:29 pm, "c.s" <[EMAIL PROTECTED]> wrote: > how do i get datepicker to display 5 days previous from date selected? > bascially date range but i don't want to set it for being between > specific dates. the fuctionality i'm looking for is user selects today > date...date picker shows today's date and 4/5 days prior--i need to be > able to retrieve this data...date picker pass it somehow? > > is this sort of functionality available or do i need to write the code > for it? > > i'm still wadding around jquerythanks for patience
[jQuery] Re: dynaCloud - alphabetical sorting and allow & in words?
So I got the cloud sorting alphabetically by changing the sort function from [code] if ($.dynaCloud.sort) { cl.sort(function(a, b) { if (a.count == b.count) { return a.el < b.el ? -1 : (a.el == b.el ? 0 : 1); } else { return a.count < b.count ? 1 : -1; } }); } [/code] to [code] if ($.dynaCloud.sort) { cl.sort(function(a, b) { return a.el < b.el ? -1 : (a.el == b.el ? 0 : 1); }); } [/code] still trying to figure out how to add an & into what I think is the permitted character list. var word = /^[a-z]*[A-Z]([A-Z]+|[a-z]{3,})/; On Sep 21, 6:45 pm, pedalpete <[EMAIL PROTECTED]> wrote: > I've been playing with theDynaCloudplugin over the weekend and as > per normal, I don't have a standard implementation. > > I'm using the tag-cloud as a way to define musical genres on my site. > The list is created dynamically, which is whydynacloudis an awesome > implementation. > > But I'm having a few problems. > > 1) First of all, the 'sort' options sorts by most popular occurance, > but I'm trying to figure out how to sort alphabetically. > 2) some of my genres have multi-word or special characters, and > thedynacloudbreaks these into seperate words in the tag cloud. > For instance, R&B becomes 'r' and then somewhere else in the tag cloud > becomes 'b' or nu-jazz becomes 'nu' and 'jazz' gets added to the other > jazz entries. > I've resolved this in multi-word genres by using [code] [/code] > which strangely does not get filtered out, but [code]&[/code] does > seem to get filtered. > > As far as I can tell, the regular expressions for stripping values is > below (though i could be wrong). > I've tried adding in &, but haven't been able to get it to work. > [code] > var elems = $(this).text().replace(/\W/g, " > ").replace($.dynaCloud.stopwords, " ").split(" "); > var word = /^[a-z]*[A-Z]([A-Z]+|[a-z]{3,})/; > [/code] > > I've posted a demo athttp://zifimusic.com/tagCloud > Though the demo only shows the tag cloud, it isn't hooked up to any > further functionality yet.
[jQuery] Re: cool new DatePicker with a familiar name, but how to make multi-month start with current
Very nice work around Wayne, can't believe I didn't think of that. Here's the code I used to set-up the next month in case anybody else needs this. [code] function multiCalDate(){ var startingDate = new Date(); var startMonth = startingDate.addMonths(1); return startMonth; } [/code] On Sep 22, 1:00 pm, Wayne <[EMAIL PROTECTED]> wrote: > Wow, that's got some pretty styling. Good find. > > I don't know how to modify the plugin code, but I found that if you > want to display the current month as the first month, you can set the > current value to a date in next month, while leaving the date value to > the date you want initially selected. > > As follows: > $('#date').DatePicker({ > flat: true, > date: '2008-09-22', > current: '2008-10-01', > calendars: 3, > starts: 1 > }); > > Hope that helps, > -Wayne > > On Sep 22, 2:40 pm, pedalpete <[EMAIL PROTECTED]> wrote: > > > I've been using Kevin Lucks datepicker for the past few months, and I > > was trying to figure out how to make it a 'range' datepicker when I > > came acrosshttp://www.eyecon.ro/datepicker/ > > The naming will probably get confusing, but this is a really nice > > range picker. > > > I am having one problem with it though. > > When I show multiple calendars on my page (3), I've got is showing > > last month, this month, and next month, but I'm trying to get the code > > to show this month, next month, following month as there is no point > > in having history on my site. > > > The section of code which defines which calendars to display is > > [code] > > for (var i = ; i < options.calendars; i++) { > > date = new Date(options.current); > > date.addMonths(-currentCal +i); > > tblCal = cal.find('table').eq(i+1); > > switch (tblCal[0].className) { > > case 'datepickerViewDays': > > dow = > > formatDate(date, 'B, Y'); > > [/code] > > > changing to 'date.addMonths(currentCal +i)' starts at next month, and > > everything else I've tried screws everything up. > > > Any idea how to change this code to show this month?
[jQuery] cool new DatePicker with a familiar name, but how to make multi-month start with current
I've been using Kevin Lucks datepicker for the past few months, and I was trying to figure out how to make it a 'range' datepicker when I came across http://www.eyecon.ro/datepicker/ The naming will probably get confusing, but this is a really nice range picker. I am having one problem with it though. When I show multiple calendars on my page (3), I've got is showing last month, this month, and next month, but I'm trying to get the code to show this month, next month, following month as there is no point in having history on my site. The section of code which defines which calendars to display is [code] for (var i = ; i < options.calendars; i++) { date = new Date(options.current); date.addMonths(-currentCal +i); tblCal = cal.find('table').eq(i+1); switch (tblCal[0].className) { case 'datepickerViewDays': dow = formatDate(date, 'B, Y'); [/code] changing to 'date.addMonths(currentCal +i)' starts at next month, and everything else I've tried screws everything up. Any idea how to change this code to show this month?
[jQuery] Re: star ratings pllugin
my quick guess would be that you need a comma. [code] class="star {split:4, required:true}" [/code] but that is just a quick guess based on what i've seen in Jquery before. On Sep 21, 4:54 pm, chadmichael <[EMAIL PROTECTED]> wrote: > I would like to be able to feed two options into the class name. The > following example is from the project page, and works fine. > > class="star {split:4}" > > BUt when I try something like > > class="star {split:4 required:true}" > > It doesn't work?
[jQuery] dynaCloud - alphabetical sorting and allow & in words?
I've been playing with the DynaCloud plugin over the weekend and as per normal, I don't have a standard implementation. I'm using the tag-cloud as a way to define musical genres on my site. The list is created dynamically, which is why dynacloud is an awesome implementation. But I'm having a few problems. 1) First of all, the 'sort' options sorts by most popular occurance, but I'm trying to figure out how to sort alphabetically. 2) some of my genres have multi-word or special characters, and the dynacloud breaks these into seperate words in the tag cloud. For instance, R&B becomes 'r' and then somewhere else in the tag cloud becomes 'b' or nu-jazz becomes 'nu' and 'jazz' gets added to the other jazz entries. I've resolved this in multi-word genres by using [code] [/code] which strangely does not get filtered out, but [code]&[/code] does seem to get filtered. As far as I can tell, the regular expressions for stripping values is below (though i could be wrong). I've tried adding in &, but haven't been able to get it to work. [code] var elems = $(this).text().replace(/\W/g, " ").replace($.dynaCloud.stopwords, " ").split(" "); var word = /^[a-z]*[A-Z]([A-Z]+|[a-z]{3,})/; [/code] I've posted a demo at http://zifimusic.com/tagCloud Though the demo only shows the tag cloud, it isn't hooked up to any further functionality yet.
[jQuery] Re: scrollTo anchor or class in div
And for todays lesson, this is how we hang our heads in shame... :( SSSO sorry about that Ariel - I checked that like 3 or 4 times after the function, but apparently didn't check before the function On Sep 11, 11:46 am, Ariel Flesler <[EMAIL PROTECTED]> wrote: > It turned out to be pretty simple. > > You put > $('#showsList') > And > > > They obviously don't match :) > > -- > Ariel Fleslerhttp://flesler.blogspot.com/ > > On Sep 10, 8:51 pm, pedalpete <[EMAIL PROTECTED]> wrote: > > > I've upgraded to 1.2.6, and added an alert to show that scrollToshow() > > is actually being called. > > > The Location.toString() error is a flash cross-domain xml error, > > nothing to do with jquery. > > > I've set-up a test site for this > > athttp://zifimusic.com/scrollTo?showid=1388718 > > > but just to confirm, the code as I have it looks correct? I'm > > wondering if maybe it is something else in my code, but I've added a > > letter to the front of the id's, so that should work (though I haven't > > tested that extensively. > > > On Sep 10, 3:03 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > It makes sense, yes. > > > I added some breakpoints, and it doesn't seem to be stepping into > > > getShow(). > > > > That could be my crazy Firebug. Could you make sure the scrollToShow() > > > function is actually being called ? > > > The page reports one of those odd errores about Location.toString(). > > > > Also, note that you're using jQuery 1.2.4 which was a bad version, try > > > upgrading to 1.2.6. > > > > Cheers > > > > -- > > > Ariel Fleslerhttp://flesler.blogspot.com/ > > > > On Sep 9, 8:42 pm, pedalpete <[EMAIL PROTECTED]> wrote: > > > > > Sorry Ariel, > > > > My bad, this might make it easierhttp://HearWhere.com?showid=1388718 > > > > > if you follow that link, it will load coldplay and there shows. > > > > > If you scroll down to the upcoming coldplay shows, there is a section > > > > with a small map on the left and a scrollable list on the right. > > > > From that link, you can't see the highlighted coldplay show - but if > > > > you scroll down the list (not the page), you will see a show with a > > > > green and orange background. > > > > > What I am attempting to do is to scrollTo that show so the user makes > > > > the connection between the show they selected and what is shown on the > > > > map. > > > > Otherwise, they are looking at a list of shows, but don't see the show > > > > they selected. > > > > > I hope that makes sense. > > > > > On Sep 9, 3:47 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > > > I really can't find what you mention, I see the content that is loaded > > > > > by ajax, but can't figure out what kind of scrolling you need. > > > > > > If you can reduce the situation/problem to something small and > > > > > minimalistic, I'll check it out asap. > > > > > > Cheers > > > > > > -- > > > > > Ariel Fleslerhttp://flesler.blogspot.com/ > > > > > > On Sep 9, 4:03 pm,pedalpete<[EMAIL PROTECTED]> wrote: > > > > > > > Hey Ariel, > > > > > > > I've kept playing with this, but just can't seem to get it to work. > > > > > > > I've launched my site now, so if you have a chance, can I ask you to > > > > > > take a look? > > > > > > > The site iswww.HearWhere.com-andthescrollI'mtrying to get to is > > > > > > after you select an artist, and the artists shows list appears from > > > > > > an > > > > > > ajax request. > > > > > > > this is more common with 'Featured Artists' as it seems you have a > > > > > > better chance that they have a long list of shows. > > > > > > > I can add the 'a' back to the beginning of the id's if that is > > > > > > really > > > > > > needed, but means I need to change a few things in my code as I > > > > > > regularly use the id as a number. > > > > > > > Thanks, > > > > > > Pete > > > > > > > On Sep 7, 9:55 am, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > > >
[jQuery] Re: scrollTo anchor or class in div
I've upgraded to 1.2.6, and added an alert to show that scrollToshow() is actually being called. The Location.toString() error is a flash cross-domain xml error, nothing to do with jquery. I've set-up a test site for this at http://zifimusic.com/scrollTo?showid=1388718 but just to confirm, the code as I have it looks correct? I'm wondering if maybe it is something else in my code, but I've added a letter to the front of the id's, so that should work (though I haven't tested that extensively. On Sep 10, 3:03 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > It makes sense, yes. > I added some breakpoints, and it doesn't seem to be stepping into > getShow(). > > That could be my crazy Firebug. Could you make sure the scrollToShow() > function is actually being called ? > The page reports one of those odd errores about Location.toString(). > > Also, note that you're using jQuery 1.2.4 which was a bad version, try > upgrading to 1.2.6. > > Cheers > > -- > Ariel Fleslerhttp://flesler.blogspot.com/ > > On Sep 9, 8:42 pm, pedalpete <[EMAIL PROTECTED]> wrote: > > > Sorry Ariel, > > My bad, this might make it easierhttp://HearWhere.com?showid=1388718 > > > if you follow that link, it will load coldplay and there shows. > > > If you scroll down to the upcoming coldplay shows, there is a section > > with a small map on the left and a scrollable list on the right. > > From that link, you can't see the highlighted coldplay show - but if > > you scroll down the list (not the page), you will see a show with a > > green and orange background. > > > What I am attempting to do is to scrollTo that show so the user makes > > the connection between the show they selected and what is shown on the > > map. > > Otherwise, they are looking at a list of shows, but don't see the show > > they selected. > > > I hope that makes sense. > > > On Sep 9, 3:47 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > I really can't find what you mention, I see the content that is loaded > > > by ajax, but can't figure out what kind of scrolling you need. > > > > If you can reduce the situation/problem to something small and > > > minimalistic, I'll check it out asap. > > > > Cheers > > > > -- > > > Ariel Fleslerhttp://flesler.blogspot.com/ > > > > On Sep 9, 4:03 pm,pedalpete<[EMAIL PROTECTED]> wrote: > > > > > Hey Ariel, > > > > > I've kept playing with this, but just can't seem to get it to work. > > > > > I've launched my site now, so if you have a chance, can I ask you to > > > > take a look? > > > > > The site iswww.HearWhere.com-andthescroll I'm trying to get to is > > > > after you select an artist, and the artists shows list appears from an > > > > ajax request. > > > > > this is more common with 'Featured Artists' as it seems you have a > > > > better chance that they have a long list of shows. > > > > > I can add the 'a' back to the beginning of the id's if that is really > > > > needed, but means I need to change a few things in my code as I > > > > regularly use the id as a number. > > > > > Thanks, > > > > Pete > > > > > On Sep 7, 9:55 am, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > > > ScrollTo doesn't bind, just scrolls, so no need to use LiveQuery to > > > > > call it. > > > > > Also, id's can't start with a number. > > > > > > Example: > > > > > > function scrollToID( id ) { > > > > > $('#hold').scrollTo( '#'+id, 1000 ); > > > > > > } > > > > > > $('#hold').load('someData.php', function(){ > > > > > scrollToID( 'foo' ); > > > > > > }); > > > > > > -- > > > > > Ariel Fleslerhttp://flesler.blogspot.com/ > > > > > > On Sep 6, 11:57 pm,pedalpete<[EMAIL PROTECTED]> wrote: > > > > > > > Thanks Ariel, > > > > > > > I guess I should be using scrollTo rather than LocalScroll. > > > > > > > Unfortunately I won't have a demo up for a few days. > > > > > > > I started to wonder if part of the problem was that the scrollable > > > > > > list is returned via ajax, so I have tried using livequery, but > > > > > > still > > >
[jQuery] Re: scrollTo anchor or class in div
Sorry Ariel, My bad, this might make it easier http://HearWhere.com?showid=1388718 if you follow that link, it will load coldplay and there shows. If you scroll down to the upcoming coldplay shows, there is a section with a small map on the left and a scrollable list on the right. >From that link, you can't see the highlighted coldplay show - but if you scroll down the list (not the page), you will see a show with a green and orange background. What I am attempting to do is to scrollTo that show so the user makes the connection between the show they selected and what is shown on the map. Otherwise, they are looking at a list of shows, but don't see the show they selected. I hope that makes sense. On Sep 9, 3:47 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > I really can't find what you mention, I see the content that is loaded > by ajax, but can't figure out what kind of scrolling you need. > > If you can reduce the situation/problem to something small and > minimalistic, I'll check it out asap. > > Cheers > > -- > Ariel Fleslerhttp://flesler.blogspot.com/ > > On Sep 9, 4:03 pm,pedalpete<[EMAIL PROTECTED]> wrote: > > > Hey Ariel, > > > I've kept playing with this, but just can't seem to get it to work. > > > I've launched my site now, so if you have a chance, can I ask you to > > take a look? > > > The site iswww.HearWhere.com-and the scroll I'm trying to get to is > > after you select an artist, and the artists shows list appears from an > > ajax request. > > > this is more common with 'Featured Artists' as it seems you have a > > better chance that they have a long list of shows. > > > I can add the 'a' back to the beginning of the id's if that is really > > needed, but means I need to change a few things in my code as I > > regularly use the id as a number. > > > Thanks, > > Pete > > > On Sep 7, 9:55 am, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > ScrollTo doesn't bind, just scrolls, so no need to use LiveQuery to > > > call it. > > > Also, id's can't start with a number. > > > > Example: > > > > function scrollToID( id ) { > > > $('#hold').scrollTo( '#'+id, 1000 ); > > > > } > > > > $('#hold').load('someData.php', function(){ > > > scrollToID( 'foo' ); > > > > }); > > > > -- > > > Ariel Fleslerhttp://flesler.blogspot.com/ > > > > On Sep 6, 11:57 pm,pedalpete<[EMAIL PROTECTED]> wrote: > > > > > Thanks Ariel, > > > > > I guess I should be using scrollTo rather than LocalScroll. > > > > > Unfortunately I won't have a demo up for a few days. > > > > > I started to wonder if part of the problem was that the scrollable > > > > list is returned via ajax, so I have tried using livequery, but still > > > > no scrolling. > > > > > Here's the code I'm using now > > > > [code] > > > > function scrollToShow(trackid){ > > > > $('#hold').livequery(function(){ > > > > $('#hold').scrollTo($('.holdList #'+trackid)); > > > > }); > > > > } > > > > > [/code] > > > > > the id is a numeric value, so hopefully that won't be causing > > > > problems. > > > > > Does the code look right to you? > > > > the '#hold' is a non-scrolling div, and the '.holdList' is the > > > > scrolling div. > > > > I've also tried > > > > [code] > > > > $('.holdList').scrollTo($('.#'+trackid')); > > > > [/code] > > > > but that didn't work either. > > > > > Thanks for your help, > > > > Pete > > > > On Sep 6, 6:16 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > > > That function is meant to start a scrolling animation ? > > > > > > LocalScroll is meant to be called to "prepare" the field, that is, > > > > > bound events that will eventually trigger scrolling. > > > > > ScrollTo is the one to call for an instant scroll. > > > > > > You either call LocalScroll at start, or ScrollTo manually if you want > > > > > to do all that yourself. > > > > > > Note that the 'target' property needs to be the scrollable element. > > > > > If you hav
[jQuery] Re: How to select all input elements but the button one?
Are you trying to put them all into an object? or a variable? I would normally say use something like [code] $('input').each(function(){ On Sep 9, 12:00 pm, aldomatic <[EMAIL PROTECTED]> wrote: > I'm trying to select all input elements but the submit or button. > > I appreciate the help. > > Aldo
[jQuery] Re: scrollTo anchor or class in div
Hey Ariel, I've kept playing with this, but just can't seem to get it to work. I've launched my site now, so if you have a chance, can I ask you to take a look? The site is www.HearWhere.com - and the scroll I'm trying to get to is after you select an artist, and the artists shows list appears from an ajax request. this is more common with 'Featured Artists' as it seems you have a better chance that they have a long list of shows. I can add the 'a' back to the beginning of the id's if that is really needed, but means I need to change a few things in my code as I regularly use the id as a number. Thanks, Pete On Sep 7, 9:55 am, Ariel Flesler <[EMAIL PROTECTED]> wrote: > ScrollTo doesn't bind, just scrolls, so no need to use LiveQuery to > call it. > Also, id's can't start with a number. > > Example: > > function scrollToID( id ) { > $('#hold').scrollTo( '#'+id, 1000 ); > > } > > $('#hold').load('someData.php', function(){ > scrollToID( 'foo' ); > > }); > > -- > Ariel Fleslerhttp://flesler.blogspot.com/ > > On Sep 6, 11:57 pm,pedalpete<[EMAIL PROTECTED]> wrote: > > > Thanks Ariel, > > > I guess I should be using scrollTo rather than LocalScroll. > > > Unfortunately I won't have a demo up for a few days. > > > I started to wonder if part of the problem was that the scrollable > > list is returned via ajax, so I have tried using livequery, but still > > no scrolling. > > > Here's the code I'm using now > > [code] > > function scrollToShow(trackid){ > > $('#hold').livequery(function(){ > > $('#hold').scrollTo($('.holdList #'+trackid)); > > }); > > } > > > [/code] > > > the id is a numeric value, so hopefully that won't be causing > > problems. > > > Does the code look right to you? > > the '#hold' is a non-scrolling div, and the '.holdList' is the > > scrolling div. > > I've also tried > > [code] > > $('.holdList').scrollTo($('.#'+trackid')); > > [/code] > > but that didn't work either. > > > Thanks for your help, > > Pete > > On Sep 6, 6:16 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > > > That function is meant to start a scrolling animation ? > > > > LocalScroll is meant to be called to "prepare" the field, that is, > > > bound events that will eventually trigger scrolling. > > > ScrollTo is the one to call for an instant scroll. > > > > You either call LocalScroll at start, or ScrollTo manually if you want > > > to do all that yourself. > > > > Note that the 'target' property needs to be the scrollable element. > > > If you have a demo online, it'll be easier to pull this out. > > > > Cheers > > > > -- > > > Ariel Fleslerhttp://flesler.blogspot.com/ > > > > On Sep 6, 7:59 pm,pedalpete<[EMAIL PROTECTED]> wrote: > > > > > Thanks Karl, I didn't realize I shouldn't start an id with numeric > > > > characters, I've been doing it for a long time without issue. > > > > > I've tried the changes you recommended, but still no scrolling. > > > > > I added an 'a' to the beginning of the id, and now my code is > > > > > [code] > > > > function scrollToShow(trackid){ > > > > $.localScroll({ > > > > target: '.holdList li#a'+trackid, //could be a > > > > selector or a jQuery > > > > object too. > > > > queue:true, > > > > duration:1000, > > > > hash:true > > > > }); > > > > } > > > > [/code] > > > > > i've checked that I have the right class name for the list, and that > > > > the id's are in the html properly. > > > > > On Sep 6, 2:03 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote: > > > > > > Use something like id="number1" rather than name="number1". (Just a > > > > > note, technically an id needs to start with a none numeric character). > > > > > Then use target: '#'number' + trackid > > > > > > The name attribute is really only for form input elements. > > > > > > Karl Rudd > > > > > > On Sa
[jQuery] Re: scrollTo anchor or class in div
Thanks Ariel, I guess I should be using scrollTo rather than LocalScroll. Unfortunately I won't have a demo up for a few days. I started to wonder if part of the problem was that the scrollable list is returned via ajax, so I have tried using livequery, but still no scrolling. Here's the code I'm using now [code] function scrollToShow(trackid){ $('#hold').livequery(function(){ $('#hold').scrollTo($('.holdList #'+trackid)); }); } [/code] the id is a numeric value, so hopefully that won't be causing problems. Does the code look right to you? the '#hold' is a non-scrolling div, and the '.holdList' is the scrolling div. I've also tried [code] $('.holdList').scrollTo($('.#'+trackid')); [/code] but that didn't work either. Thanks for your help, Pete On Sep 6, 6:16 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > That function is meant to start a scrolling animation ? > > LocalScroll is meant to be called to "prepare" the field, that is, > bound events that will eventually trigger scrolling. > ScrollTo is the one to call for an instant scroll. > > You either call LocalScroll at start, or ScrollTo manually if you want > to do all that yourself. > > Note that the 'target' property needs to be the scrollable element. > If you have a demo online, it'll be easier to pull this out. > > Cheers > > -- > Ariel Fleslerhttp://flesler.blogspot.com/ > > On Sep 6, 7:59 pm, pedalpete <[EMAIL PROTECTED]> wrote: > > > Thanks Karl, I didn't realize I shouldn't start an id with numeric > > characters, I've been doing it for a long time without issue. > > > I've tried the changes you recommended, but still no scrolling. > > > I added an 'a' to the beginning of the id, and now my code is > > > [code] > > function scrollToShow(trackid){ > > $.localScroll({ > > target: '.holdList li#a'+trackid, //could be a > > selector or a jQuery > > object too. > > queue:true, > > duration:1000, > > hash:true > > }); > > } > > [/code] > > > i've checked that I have the right class name for the list, and that > > the id's are in the html properly. > > > On Sep 6, 2:03 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote: > > > > Use something like id="number1" rather than name="number1". (Just a > > > note, technically an id needs to start with a none numeric character). > > > Then use target: '#'number' + trackid > > > > The name attribute is really only for form input elements. > > > > Karl Rudd > > > > On Sat, Sep 6, 2008 at 12:17 PM, pedalpete <[EMAIL PROTECTED]> wrote: > > > > > I've got a div on my page with a scrollable list in it. > > > > When I load the page, I want the list to scroll to a specific item. > > > > Each item has a class and name, so I'm trying to address them with > > > > that. > > > > > I've been toying with the flesler scroll plugins, but am not sure if > > > > they are what i should be using. > > > > > .scrollTo kept throwing errors at me, but .localScroll doesn't error > > > > out, but doesn't scroll either. > > > > > here's the code I'm using > > > > [code] > > > > function scrollToShow(showid){ > > > > $.localScroll({ > > > > target: '.holdList li.'+trackid, //could be a selector > > > > or a jQuery > > > > object too. > > > > queue:true, > > > > duration:1000, > > > > hash:true > > > > }); > > > > } > > > > [/code] > > > > > the code for the list is pretty simplelike this > > > > [code] > > > > > > > > first in list > > > > second in list > > > > > > > > [/code] > > > > > Any idea on a simple way to do this? Or if the .localScroll > > > > or .scrollTo allow scrolling in a div? > >
[jQuery] Re: scrollTo anchor or class in div
I've also tried using a class instead of id, but no joy :( On Sep 6, 3:59 pm, pedalpete <[EMAIL PROTECTED]> wrote: > Thanks Karl, I didn't realize I shouldn't start an id with numeric > characters, I've been doing it for a long time without issue. > > I've tried the changes you recommended, but still no scrolling. > > I added an 'a' to the beginning of the id, and now my code is > > [code] > function scrollToShow(trackid){ > $.localScroll({ > target: '.holdList li#a'+trackid, //could be a > selector or a jQuery > object too. > queue:true, > duration:1000, > hash:true > }); > } > [/code] > > i've checked that I have the right class name for the list, and that > the id's are in the html properly. > > On Sep 6, 2:03 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote: > > > Use something like id="number1" rather than name="number1". (Just a > > note, technically an id needs to start with a none numeric character). > > Then use target: '#'number' + trackid > > > The name attribute is really only for form input elements. > > > Karl Rudd > > > On Sat, Sep 6, 2008 at 12:17 PM, pedalpete <[EMAIL PROTECTED]> wrote: > > > > I've got a div on my page with a scrollable list in it. > > > When I load the page, I want the list to scroll to a specific item. > > > Each item has a class and name, so I'm trying to address them with > > > that. > > > > I've been toying with the flesler scroll plugins, but am not sure if > > > they are what i should be using. > > > > .scrollTo kept throwing errors at me, but .localScroll doesn't error > > > out, but doesn't scroll either. > > > > here's the code I'm using > > > [code] > > > function scrollToShow(showid){ > > > $.localScroll({ > > > target: '.holdList li.'+trackid, //could be a selector or > > > a jQuery > > > object too. > > > queue:true, > > > duration:1000, > > > hash:true > > > }); > > > } > > > [/code] > > > > the code for the list is pretty simplelike this > > > [code] > > > > > > first in list > > > second in list > > > > > > [/code] > > > > Any idea on a simple way to do this? Or if the .localScroll > > > or .scrollTo allow scrolling in a div? > >
[jQuery] Re: scrollTo anchor or class in div
Thanks Karl, I didn't realize I shouldn't start an id with numeric characters, I've been doing it for a long time without issue. I've tried the changes you recommended, but still no scrolling. I added an 'a' to the beginning of the id, and now my code is [code] function scrollToShow(trackid){ $.localScroll({ target: '.holdList li#a'+trackid, //could be a selector or a jQuery object too. queue:true, duration:1000, hash:true }); } [/code] i've checked that I have the right class name for the list, and that the id's are in the html properly. On Sep 6, 2:03 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote: > Use something like id="number1" rather than name="number1". (Just a > note, technically an id needs to start with a none numeric character). > Then use target: '#'number' + trackid > > The name attribute is really only for form input elements. > > Karl Rudd > > On Sat, Sep 6, 2008 at 12:17 PM, pedalpete <[EMAIL PROTECTED]> wrote: > > > I've got a div on my page with a scrollable list in it. > > When I load the page, I want the list to scroll to a specific item. > > Each item has a class and name, so I'm trying to address them with > > that. > > > I've been toying with the flesler scroll plugins, but am not sure if > > they are what i should be using. > > > .scrollTo kept throwing errors at me, but .localScroll doesn't error > > out, but doesn't scroll either. > > > here's the code I'm using > > [code] > > function scrollToShow(showid){ > > $.localScroll({ > > target: '.holdList li.'+trackid, //could be a selector or a > > jQuery > > object too. > > queue:true, > > duration:1000, > > hash:true > > }); > > } > > [/code] > > > the code for the list is pretty simplelike this > > [code] > > > > first in list > > second in list > > > > [/code] > > > Any idea on a simple way to do this? Or if the .localScroll > > or .scrollTo allow scrolling in a div? > >
[jQuery] scrollTo anchor or class in div
I've got a div on my page with a scrollable list in it. When I load the page, I want the list to scroll to a specific item. Each item has a class and name, so I'm trying to address them with that. I've been toying with the flesler scroll plugins, but am not sure if they are what i should be using. .scrollTo kept throwing errors at me, but .localScroll doesn't error out, but doesn't scroll either. here's the code I'm using [code] function scrollToShow(showid){ $.localScroll({ target: '.holdList li.'+trackid, //could be a selector or a jQuery object too. queue:true, duration:1000, hash:true }); } [/code] the code for the list is pretty simplelike this [code] first in list second in list [/code] Any idea on a simple way to do this? Or if the .localScroll or .scrollTo allow scrolling in a div?
[jQuery] Re: Alternate colors of a list ( )
It should be the same. [code] $('li:even').addClass('even'); [/code] I'm using it on divs, so it should work on li's as well. On Sep 5, 1:02 pm, "Gewton Jhames" <[EMAIL PROTECTED]> wrote: > Alternate background-color of trs of a table is very easy with jquery, but, > anyone knows how to alternate these colors of an list? ? I mean, > alternate the colors of the s of the list > > Thanks!
[jQuery] return on error - how to handle an error when an address is not returned in jmaps
I've been using the jmaps plugin for a bit, and I added a bit of code to it so that when an address is not found, it writes a message to the user. I now have a situation where there are two different locations on the page where the message might be written to, depending on what the user has done (did they select an address? or did they search for an address?). I've been trying to launch a function from the plugin, but I keep getting 'function not found errors', and I've tried returning a null value, or testing for a null value, but that hasn't worked either. Any ideas on this would be appreciated. The change I've made to the plugin is simply [code] if(!F){ $('.searchHolder').html('
[jQuery] Re: ajax IE error - only loads parts of the response
HOLY FRUSTRATING!!! Turns out this was an error being that i had an extra div in the output! rrrggghh.. well, that was the first problem anyway, i suspect the second problem is similar. Thanks for the help, Pete On Aug 26, 8:31 pm, pedalpete <[EMAIL PROTECTED]> wrote: > Hey Gang, > > I've got two problems with IE (6&7) on a page that works perfectly in > Safari. > > The problem seems to be that when retrieving an ajax response, only > parts of the response are properly loaded into the page. > > if you want to take a look, I've set up a test environment > athttp://zifimusic.com/test-v2 > > Problem #1 > I make an ajax request to get two lists (from one request). > I then split the list into two, and the first part of the list goes > into one div, and the second part goes into a second list. > > The code I use is > [code] > success: function(response){ > $('#features').html(' class="feature">feature artists span>upcoming shows span> '); > var splitList = > response.split("remoteSplitList"); > alert(splitList[1]); > $('#popList').html(splitList[0]); > $('#holdBands').html(splitList[1]);} > > [/code] > > For some reason, IE will never show the 'splitList[1]'. I've swaped > the splitLists into the different divs, and IF I put $ > (#holdBands').html(splitList[0]);, the first part of this list will > show in the holdBands area. > I have also put an alert on the splitList[1], and it does contain the > correct content in IE. > > I've also gone through my CSS, and since it works perfectly in FF and > Safari, I think the problem may be the way the content is being > written in IE. > > The second problem is very similar. > When selecting an artist, I make an ajax request, which gets shows, > albums, etc. > For some reason if the artist has albums, only the last album shows > up, if the artist does not have albums, then everything shows up > (songs, shows, etc.). > > Again, looking at the alerts, both of the results look very similar, > and everything works in FF and Safari, but not IE's . > > Here's that bit of code too (though I doubt this will be very helpful) > [code] > success: function(response){ > alert(response); > > $('#artistPage').html(response);} > > [/code] > > I've spent many hours looking at this and trying things, but am > completely stumped... > any ideas?
[jQuery] Re: ajax IE error - only loads parts of the response
sorry, posted by accident. For some reason, the above code only returns popList in both holdBands and popList. I think using json adds a level of complexity that isn't neccesary, as the alert shows the IE can find the string, but doesn't display that string. I assume that json would convert the response into a string anyway. Is that not correct? On Aug 27, 10:29 am, pedalpete <[EMAIL PROTECTED]> wrote: > I haven't tried using JSON, but I did try manipulating the response > directly using jquery with > [code] > success: function(response){ > var popList = $(response > +' .thisPopList').html(); > var showsList = $(response+' > .thisShowList').html(); > $('#popList').html(popList); > $('#holdBands').html(showsList); > > On Aug 26, 8:56 pm, MorningZ <[EMAIL PROTECTED]> wrote: > > > Without really getting into your code too much (i've never seen > > someone try to split on a long string like that), have you considered > > using JSON (using the getJSON method) to retrieve this data instead? > > > then you could say > > > $('#popList').html(response.List); > > $('#holdBands').html(response.Bands); > > > instead of all that string manipulation stuff > >
[jQuery] Re: ajax IE error - only loads parts of the response
I haven't tried using JSON, but I did try manipulating the response directly using jquery with [code] success: function(response){ var popList = $(response +' .thisPopList').html(); var showsList = $(response+' .thisShowList').html(); $('#popList').html(popList); $('#holdBands').html(showsList); On Aug 26, 8:56 pm, MorningZ <[EMAIL PROTECTED]> wrote: > Without really getting into your code too much (i've never seen > someone try to split on a long string like that), have you considered > using JSON (using the getJSON method) to retrieve this data instead? > > then you could say > > $('#popList').html(response.List); > $('#holdBands').html(response.Bands); > > instead of all that string manipulation stuff
[jQuery] ajax IE error - only loads parts of the response
Hey Gang, I've got two problems with IE (6&7) on a page that works perfectly in Safari. The problem seems to be that when retrieving an ajax response, only parts of the response are properly loaded into the page. if you want to take a look, I've set up a test environment at http://zifimusic.com/test-v2 Problem #1 I make an ajax request to get two lists (from one request). I then split the list into two, and the first part of the list goes into one div, and the second part goes into a second list. The code I use is [code] success: function(response){ $('#features').html('feature artistsupcoming shows '); var splitList = response.split("remoteSplitList"); alert(splitList[1]); $('#popList').html(splitList[0]); $('#holdBands').html(splitList[1]); } [/code] For some reason, IE will never show the 'splitList[1]'. I've swaped the splitLists into the different divs, and IF I put $ (#holdBands').html(splitList[0]);, the first part of this list will show in the holdBands area. I have also put an alert on the splitList[1], and it does contain the correct content in IE. I've also gone through my CSS, and since it works perfectly in FF and Safari, I think the problem may be the way the content is being written in IE. The second problem is very similar. When selecting an artist, I make an ajax request, which gets shows, albums, etc. For some reason if the artist has albums, only the last album shows up, if the artist does not have albums, then everything shows up (songs, shows, etc.). Again, looking at the alerts, both of the results look very similar, and everything works in FF and Safari, but not IE's . Here's that bit of code too (though I doubt this will be very helpful) [code] success: function(response){ alert(response); $('#artistPage').html(response); } [/code] I've spent many hours looking at this and trying things, but am completely stumped... any ideas?
[jQuery] Re: jquery is not defined (newbie)
Looks like you are not properly refrencing the jquery script. You should have an entry in your header that looks like [code] [/code] except the src should point to YOUR jquery file. On Aug 24, 10:12 am, Scott Phillips <[EMAIL PROTECTED]> wrote: > I am trying to get datepicker plugin (http://eyecon.ro/datepicker/ > #about) to work on a page, and I can't get it to work for some reason. > I keep getting the following 2 errors: > > jQuery is not defined > datepicker.js()()datepicker.js (line 819) > [Break on this error] })(jQuery); > > datepicker.js (line 819) > $("#inputDate").DatePicker is not a function > [Break on this error] onChange: function(formated, dates){ > > I'm positive that the paths to jquery, etc.. are correct. This is the > code I am using to call the datepicker: > > > $(document).ready(function(){ > > $('#inputDate').DatePicker({ > format:'m/d/Y', > date: $('#inputDate').val(), > current: $('#inputDate').val(), > starts: 1, > position: 'r', > onBeforeShow: function(){ > $('#inputDate').DatePickerSetDate($('#inputDate').val(), > true); > }, > onChange: function(formated, dates){ > $('#inputDate').val(formated); > } > > }); > > }); > > > Any help is greatly appreciated!
[jQuery] Re: How dynamically create iframe and add/remove data from it
Personally, I try not mixing jquery components with standard javascript (like your document.createElement), with the exception of within functions. Somebody else can probably comment on what is appropriate. I'd write this something like [code] $('#container').append(''); $('#commentiframe').attr('src', 'http:LINK'); [/code] that should create the iFrame and get a document. But you say you want to create an iFrame and then put data into it. I'm not sure you can do that, or you would be able to inject stuff into somebody elses page, theoretically on there server. THOUGH I COULD BE VERY WRONG on this. If you are just trying to get data and display it, why not just update a div?
[jQuery] Re: My site asks for a pswd if JQuery is activated
if there is no function within your [code] $(document).ready(function(){ }); [/code] Then this shouldn't be. Did you download directly via the jQuery site? jQuery should sit quietly until you call a function, so somewhere the password function is being called. On Aug 23, 11:37 am, MBaas <[EMAIL PROTECTED]> wrote: > Hi, > > I discovered JQuery today and would like to try it out in my current > ASP-Project. So I downloaded the JS, added it to the ASP-File - and > when I now launch the page, I'm asked for a password - this is not > foreseen and clearly only happens when I include the script. What's > going on? > > Thanks > > Michael
[jQuery] Re: IE - 'object does not support this property or method'
Thanks Mike, I can't believe I missed that one. Using .join() to create the var works nicely too, and I assume the .length is quicker than an if statement? Looks simpler anyway. Thanks Pete On Aug 21, 1:26 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote: > You have a typo on line 68 of selectDate.html. "updatedDate" should be > "updateDate". That's why updateDate is undefined in IE. > > BTW, here's a way you could write that bit of code without the repetition: > > var updateDate = [ > splitDate[1], > splitDate[2], > splitDate[3], > splitDate[4].length == 4 ? splitDate[4] : splitDate[6], > '' > ].join(' '); > > -Mike > > > From:pedalpete > > > Hey gang, > > > I've written a bit of jquery code which I am absolutely > > amazed works on both Safari and FF, but IE is giving me errors. > > > I've put the code on an external server so you can see what it is. > >http://zifimusic.com/mapickl/selectDate.html > > > Basically what I have is a select list which when hovered > > over user superfish as a dropdown menu. Then when hovering > > over the 'select date' option from the select list (which is > > actually superfish), the datepicker is shown. > > When a use selects a date, that date is updated in the select > > list as selected. > > > This works fine in Safari and FF, but when selecting a date > > in IE, the date is not passed to the select list. > > Here's the code I've got to get this all going. > > > [code] > > function updateDateForm(updateDate){ > > alert(updateDate); > > $('.updateDate').val(updateDate).html(updateDate); > > } > > > $('.dropped .item').livequery('click', function(){ > > var updateDate = $(this).html(); > > updateDateForm(updateDate); > > }); > > > $('.dropped .dateItem').each( > > function() > > { > > $this = $(this); > > > $this > > .datePicker() > > .bind( > > 'mouseover', > > function() > > { > > $(this).dpDisplay(); > > this.blur(); > > return false; > > } > > ) > > .bind( > > 'dateSelected', > > function(e, selectedDate, $td) > > { > > var getDate = ' '+selectedDate; > > var splitDate = getDate.split(" "); > > if(splitDate[4].length!=4){ > > var updatedDate = > > splitDate[1]+' '+splitDate[2]+' > > '+splitDate[3]+' '+splitDate[6]+' '; > > } else { > > var updateDate = > > splitDate[1]+' '+splitDate[2]+' > > '+splitDate[3]+' '+splitDate[4]+' '; > > } > > updateDateForm(updateDate); > > } > > ); > > }); > > [/code] > > > The reason I'm doing all of this is to get a somewhat clean > > and simple UI for selecting a date (date-range likely coming > > soon). The way I had it before, without a select list, meant > > that the look was very inconsistent, particularly with Safari. > > > Thanks, > > Pete
[jQuery] IE - 'object does not support this property or method'
Hey gang, I've written a bit of jquery code which I am absolutely amazed works on both Safari and FF, but IE is giving me errors. I've put the code on an external server so you can see what it is. http://zifimusic.com/mapickl/selectDate.html Basically what I have is a select list which when hovered over user superfish as a dropdown menu. Then when hovering over the 'select date' option from the select list (which is actually superfish), the datepicker is shown. When a use selects a date, that date is updated in the select list as selected. This works fine in Safari and FF, but when selecting a date in IE, the date is not passed to the select list. Here's the code I've got to get this all going. [code] function updateDateForm(updateDate){ alert(updateDate); $('.updateDate').val(updateDate).html(updateDate); } $('.dropped .item').livequery('click', function(){ var updateDate = $(this).html(); updateDateForm(updateDate); }); $('.dropped .dateItem').each( function() { $this = $(this); $this .datePicker() .bind( 'mouseover', function() { $(this).dpDisplay(); this.blur(); return false; } ) .bind( 'dateSelected', function(e, selectedDate, $td) { var getDate = ' '+selectedDate; var splitDate = getDate.split(" "); if(splitDate[4].length!=4){ var updatedDate = splitDate[1]+' '+splitDate[2]+' '+splitDate[3]+' '+splitDate[6]+' '; } else { var updateDate = splitDate[1]+' '+splitDate[2]+' '+splitDate[3]+' '+splitDate[4]+' '; } updateDateForm(updateDate); } ); }); [/code] The reason I'm doing all of this is to get a somewhat clean and simple UI for selecting a date (date-range likely coming soon). The way I had it before, without a select list, meant that the look was very inconsistent, particularly with Safari. Thanks, Pete
[jQuery] LightBox (or Modal) with ajax response from a POST type
I've been trying this a while using multiple types of lightboxes, as well as jqm - modal (and another modal but I can't remember what it was called). I have an ajax page that I retrieve with [code] $.ajax({ type: "POST", url: "add.php", data: "c="+c+"&sid="+sid, success: function(response){ $('#pop-up').html(response); } }); [/code] but I'm unable to get any sort of lightbox that works with a POST, all the onces I've seen take the parameters from a link, but I can't quite do that. Has anybody had a lightbox or modal working with a page that is retrieved via ajax with post parameters? Any idea who to accomplish this? Clearly what I've been trying hasn't been working, so I don't think there is any point in showing you what I've got, 'cause I'm quite sure I'm off on the completely wrong track.
[jQuery] Re: datepicker select to update a div, and strange datepicker css issue
that's great kevin, Thank you. i didn't realize the selectedDate wasn't a string, i thought if i put var x=xyz, that makes it a string. I'm still fairly new to programming and learning lots. Thanks for your help, I hope I understood that correctly. Pete