[jQuery] Re: sortable: drag list items by custom handle
Thank you tlphipps! It was under my nose all the time... emi On Thu, May 8, 2008 at 4:13 PM, tlphipps <[EMAIL PROTECTED]> wrote: > > You need to use the "handle" option as detailed here: > http://docs.jquery.com/UI/Draggables/draggable#options > (the sortable docs refer you to this description for that handle > option) > > On May 8, 4:09 am, "emi polak" <[EMAIL PROTECTED]> wrote: > > Hi there, > > I am using $("#myList").sortable({}); to "sortable-ize" a ul list. All > works > > fine, however the entire "li" element responds to dragging and I want the > > "li" elements to be draggable only by using a custom handle like this: > > > > > > some content here > > MY HANDLE > > > > > > Any ideas? Thank you! > > > > emi >
[jQuery] sortable: drag list items by custom handle
Hi there, I am using $("#myList").sortable({}); to "sortable-ize" a ul list. All works fine, however the entire "li" element responds to dragging and I want the "li" elements to be draggable only by using a custom handle like this: some content here MY HANDLE Any ideas? Thank you! emi
[jQuery] Re: animate() canceling
Hey Eric, that works like a charm. Thank you so much! Emi Polak On 9/2/07, Erik Beeson <[EMAIL PROTECTED]> wrote: > > In fact, if you find yourself wanting to do a lot of stuff when scrolling > has stopped, you could add an event for it (again, untested): > > (function($) { >var scrollTimeoutID; >$(window).bind('scroll', function() { > clearTimeout(scrollTimeoutID); > scrollTimeoutID = setTimeout(function() { > $(window).trigger('scrollstop'); > }, 300); >}); > })(jQuery); > > $(document).ready(function() { >var topOffset = 100; >$("#label").css('top', topOffset + "px"); > >$(window).bind('scrollstop', function() { > $("#label").animate({top: $(document).scrollTop() + topOffset}, > "slow", "easein"); >}); > }); > > Hope it helps. > > --Erik > > > On 9/1/07, Erik Beeson < [EMAIL PROTECTED]> wrote: > > Approaching the problem a different way, how about only firing the > > animation if scrolling has paused for a moment? Maybe something like > > (untested): > > > > $(document).ready(function() { > > var scrollTimeoutID; > > var topOffset = 100; > > $("#label").css('top', topOffset + "px"); > > > > $(window).bind('scroll', function() { > > clearTimeout(scrollTimeoutID); > > > > scrollTimeoutID = setTimeout(function() { > > $("#label").animate({top: $(document).scrollTop() + topOffset}, > > "slow", "easein"); > > }, 300); > > }); > > }); > > > > You should probably play around with that 300 to find the optimum > > setting for you. > > > > Hope it helps. > > > > --Erik > > > > > > On 9/1/07, emi polak <[EMAIL PROTECTED]> wrote: > > > no luck heh? :( > > > > > > > > > On 9/1/07, emi polak < [EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I am altering the "top" property of a floating label in a webpage. > The > > > "top" adjustement is fired at page scroll, so that the label would > always > > > stay in its place. > > > > Now I would like to animate the label between its oldPosition and > > > newPosition. So I use animate() to set the "top" property, but the > method > > > starts many times during the page scroll, thus creating a very buggy > and > > > slow motion. > > > > > > > > So: is there a way to cancel an already started animation, so that > when > > > "scroll", the animation is first canceled and then its fired again? > > > > > > > > Here is what I'm using now: > > > > > > > > var topOffset = 100; > > > > $("#label").css('top', topOffset + "px"); > > > > > > > > $(window).bind("scroll", function() { > > > > var newScrollTop = $(document).scrollTop(); > > > > var newPos = newScrollTop + topOffset; > > > > > > > > $("#label").animate({ > > > > top: newPos > > > > }, "slow", "easein"); > > > > }); > > > > > > > > Thank you! > > > > emipolak > > > > > > > > > > > > > > > > >
[jQuery] Re: animate() canceling
no luck heh? :( On 9/1/07, emi polak <[EMAIL PROTECTED]> wrote: > > Hi, > I am altering the "top" property of a floating label in a webpage. The > "top" adjustement is fired at page scroll, so that the label would always > stay in its place. > Now I would like to animate the label between its oldPosition and > newPosition. So I use animate() to set the "top" property, but the method > starts many times during the page scroll, thus creating a very buggy and > slow motion. > > So: is there a way to cancel an already started animation, so that when > "scroll", the animation is first canceled and then its fired again? > > Here is what I'm using now: > > var topOffset = 100; > $("#label").css('top', topOffset + "px"); > > $(window).bind("scroll", function() { > var newScrollTop = $(document).scrollTop(); > var newPos = newScrollTop + topOffset; > > $("#label").animate({ > top: newPos > }, "slow", "easein"); > }); > > Thank you! > emipolak > >
[jQuery] animate() canceling
Hi, I am altering the "top" property of a floating label in a webpage. The "top" adjustement is fired at page scroll, so that the label would always stay in its place. Now I would like to animate the label between its oldPosition and newPosition. So I use animate() to set the "top" property, but the method starts many times during the page scroll, thus creating a very buggy and slow motion. So: is there a way to cancel an already started animation, so that when "scroll", the animation is first canceled and then its fired again? Here is what I'm using now: var topOffset = 100; $("#label").css('top', topOffset + "px"); $(window).bind("scroll", function() { var newScrollTop = $(document).scrollTop(); var newPos = newScrollTop + topOffset; $("#label").animate({ top: newPos }, "slow", "easein"); }); Thank you! emipolak
[jQuery] Re: dimensions plugin, animated scrollLeft(x)
I'll have to wait then :p Thank you Brandon and all jQuery team. On 8/14/07, Brandon Aaron <[EMAIL PROTECTED]> wrote: > > This functionality is slated for jQuery 1.2: > http://docs.jquery.com/JQuery_1.2_Roadmap#Animating_scrollLeft.2FscrollTop > > -- > Brandon Aaron > > On 8/14/07, emi polak <[EMAIL PROTECTED]> wrote: > > > > Hello, > > I am using Dimensions for a carousel type of scroller. Two buttons (prev > > + next) controls the offset of the content inside a div (with overflow set > > to hidden). The offest is set with Dimension's scrollLeft(px). > > > > Is there a way to animate the motion of the content inside the div > > container, rather than just jump by the number of pixels set within > > scrollLeft(px)? > > And would be there another aproach to make this work (cross browser) > > without Dimensions by using animate() ? > > > > Thank you! > > > >
[jQuery] dimensions plugin, animated scrollLeft(x)
Hello, I am using Dimensions for a carousel type of scroller. Two buttons (prev + next) controls the offset of the content inside a div (with overflow set to hidden). The offest is set with Dimension's scrollLeft(px). Is there a way to animate the motion of the content inside the div container, rather than just jump by the number of pixels set within scrollLeft(px)? And would be there another aproach to make this work (cross browser) without Dimensions by using animate() ? Thank you!
[jQuery] Re: jqModal caching ajax requests
Thank you all guys for your input. Shelane, your workaround did the trick, 10x again. Strange behaviour of the jqm though (awesome plugin otherwise). Emanuel On 5/24/07, Shelane <[EMAIL PROTECTED]> wrote: Do you find this only happening in IE? There was a thread a few days ago about IE caching GET requests. The jqModal is using a GET ajax request. That thread mentions methods to cause IE to get the new data. However, that will still leave you with the jqModal wanting to load the originally inputted URL. Look at the recent thread to see me workaround: http://groups.google.com/group/jquery-en/t/40137ddd2b5cfdcc On May 24, 7:18 am, "Richard D. Worth" <[EMAIL PROTECTED]> wrote: > On 5/24/07, emi polak <[EMAIL PROTECTED]> wrote: > > > Hello, > > I am using ajax requests to populate a jqModal window. The problem is that > > the content I am loading in the window gets cached, so any future requests > > will return the cached content. > > > ... > > Any idea on how to solve this? > > > Thank you so much. > > Emanuel > > I use > > + '&nocache=' + Math.random() > > - Richard D. Worth
[jQuery] jqModal caching ajax requests
Hello, I am using ajax requests to populate a jqModal window. The problem is that the content I am loading in the window gets cached, so any future requests will return the cached content. For example, I have: $('#popupwin').jqm({ajax: 'popup.php?win=add'}).jqmShow(); This will insert content A in my window. Later on (the window gets closed in the meantime) I want to make another ajax request, for inserting content B in the jqModal window. $('#popupwin').jqm({ajax: 'popup.php?win=view}).jqmShow(); Surprise, I get content A again, instead of content B. The script wich i'm using to generate the content is functioning properly, so is surely a cache issue. I tried: $('#popupwin').jqm({ajax: 'popup.php?win=view&imgid=' + id + '&ms=' + ms}).jqmShow(); to overcome the cache, still with no result. Any idea on how to solve this? Thank you so much. Emanuel
[jQuery] Re: refferencing multiple XMLHttpRequests
It never crossed my mind that this could be so simple :) Thanks, Rob! Emi On 5/14/07, Rob Desbois <[EMAIL PROTECTED]> wrote: Hi Emi, You don't need to reference the XHR object to achieve that, just create two requests with different success functions: $.ajax({"type": "POST", "url": "foo.php ", "data": data, "dataType": "json", "success": on_success_one}); $.ajax({"type": "POST", "url": " foo2.php", "data": data, "dataType": "json", "success": on_success_two}); When the responses are received the correct function will be executed. Rob. On 5/14/07, emi polak <[EMAIL PROTECTED]> wrote: > > The manual states that "$.ajax() returns the XMLHttpRequest that it > creates". > How would these objects be referenced? > > I want to have multiple ajax calls and be able to execute different > ajaxSuccess code on each. Could you provide an example please? > > Thank you for your time! > Emi > -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 "There's a whale there's a whale there's a whale fish" he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
[jQuery] refferencing multiple XMLHttpRequests
The manual states that "$.ajax() returns the XMLHttpRequest that it creates". How would these objects be referenced? I want to have multiple ajax calls and be able to execute different ajaxSuccess code on each. Could you provide an example please? Thank you for your time! Emi
[jQuery] Re: $.ajaxSetup and timeout
That solved the problem in a beautiful way! I guess it's better to rely on plain javascript for quick solutions, where jquery documentation isn't rich in examples and explanations yet :) The jHeartbeat plugin you pointed me at looks interesting too, THANK YOU Jörn! On 4/10/07, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: emi polak schrieb: > Hello, > I want to load some html content that changes over time, so I need to > poll the server for changes from time to time. Could anyone point me > to an example of how to do this? The documentation I found contains no > example... I tried the following: > > $.ajaxSetup( { >timeout: 5000 > } ); > $(document).ready( function() { > $("#podcast_items").load("podcast_items_updater.php"); > }); > > But the load does not fire again after those 5 seconds. I also tried > including the ajaxSetup in the ready() block, and I also tried the > deprecated (according to the manual) ajaxTimeout, but none of these > seem to work. The purpose of ajaxSetup is only setting global defaults for all ajax request. The timeout option is used to cancel request after some time, the documentation for $.ajax and $.ajaxTimeout should contain some more information about that. What you need is something like this: function request() { $("#podcast_items").load("podcast_items_updater.php"); } setInterval(request, 5000); If that doesn't yet do what you need: Have a look at the jHeartbeat plugin. -- Jörn Zaefferer http://bassistance.de
[jQuery] $.ajaxSetup and timeout
Hello, I want to load some html content that changes over time, so I need to poll the server for changes from time to time. Could anyone point me to an example of how to do this? The documentation I found contains no example... I tried the following: $.ajaxSetup( { timeout: 5000 } ); $(document).ready( function() { $("#podcast_items").load("podcast_items_updater.php"); }); But the load does not fire again after those 5 seconds. I also tried including the ajaxSetup in the ready() block, and I also tried the deprecated (according to the manual) ajaxTimeout, but none of these seem to work. Thank you! Emi Polak