Re: [jQuery] [mcDropdown] Enhancement Request

2010-01-19 Thread Dan G. Switzer, II
There's no need to add this to the code. You can just place the wrapper in
the actual HTML and apply whatever CSS you need specific to the instance of
the mcDropdown.

-Dan

On Mon, Jan 18, 2010 at 4:21 PM, Jerry  wrote:

> Howdy...
>
> The GivaInc.com site says that the devs monitor this list for stuff
> and they don't give out their emails anywhere on the site. So...
>
> The mcDropdown is great but needed a little push from me in order to
> get the field to display properly on a form with labels to the left of
> the field (versus above). Because of that I needed to have a way to
> create css for the anchor and wrapper div tags inserted by the
> mcDropdown plugin.
>
> I added the following two new defaults:
>
>, wrapperId: null  // The id of the wrapper for
> more css
> control ...  added 2010-01-18 Jerry Ablan 
>, anchorId: null   // The id of the
> anchor for more css
> control  ...  added 2010-01-18 Jerry Ablan 
>
> In addition, the following was changed at line 160 (after insert of
> above two lines):
>
>// create the div to wrap everything in
>$divInput = $(' settings.anchorId !
> == null ? ' id="' + settings.anchorId + '" ' : '' ) + 'href="#"
> tabindex="-1">')
>.appendTo($(' ? 'id="' +
> settings.wrapperId + '" ' : '' ) + 'style="position: relative;"> div>'))
>.parent();
>
> With the wrapper div and anchor accessible now, I can style the CSS to
> get the field in the right place.
>
> Thanks!
>
>
>


Re: [jQuery] Sum up of selected classes

2009-11-13 Thread Dan G. Switzer, II
palgo:

You probably mean:

$("#total").val(tot);

The selector $("total") would be looking for an element named total (i.e.
,) where as $("#total") looks for an element with an id of "total".

-Dan

On Fri, Nov 13, 2009 at 10:13 AM, palgo  wrote:

> Hi guys,
>
> I have several input fields where the value get set (gave them class
> name ="part").
> I want to sum up the input values into a last input field with class =
> "total", whenever something is being typed in some other fields.
>
> The input fields with class "part" is not a fixed amount, they can
> vary between 2 to infinite.
>
> So I tried this, which doesn't work:
>
> $(".whatever").live("keyup", function(event){
>
>var arr = $(".part");
>var len = arr.length;
>var tot = 0;
>
>while (i{
>
>tot = tot +arr[i].val();
>i--;
>}
>
> $("total").val(tot);
>
>});
>
> Anyone know what I'm doing wrong?
>
>
>


[jQuery] Re: namespacing jQuery

2009-10-27 Thread Dan G. Switzer, II
See the $.noConflict() docs:
http://docs.jquery.com/Core/jQuery.noConflict

var j = *jQuery.noConflict*();
// Do something with jQuery
j("div p").hide ();
// Do something with another library's $()
$("content").style.display = 'none';


-Dan

On Tue, Oct 27, 2009 at 10:25 AM, El Greg  wrote:

>
> I'm interested in namespacing jQuery to something like $myjQ.  or myjQ.
> $ and wondering what the best way is to do it.  I will potentially be
> using my version of jQuery on other pages that are running other
> versions of jQuery - hence the idea to rename it completely so that I
> have control over version, plugins, etc.  I thought about just doing a
> find and replace on the word "jQuery" in the source, but I'm hoping
> there's an easier way.
>
> Thanks!
>


[jQuery] Re: $.post() speed

2009-10-08 Thread Dan G. Switzer, II
Adonis,
The $.post() function is asynchronous (by default) when your code hits a
$.post() call, it'll keep executing code. In order to do something with the
results of your AJAX call, you'll want to use the callback option--which is
a function run when the AJAX call is completed.

-Dan

On Thu, Oct 8, 2009 at 7:14 AM, Adonis  wrote:

>
> I am not entirely sure if i am using proper definitions here, but here
> it goes..
>
> I have $.post() inside javascript functions. If ajax is successfull,
> it returns data from the server. I am trying to assign this data  to
> javascript global variables. The problem is that my global javascript
> variables end up to be empty. It seems it takes time for the ajax to
> return the data and by the time the server data is returned, the
> browser has comploted reading through the rest of the javascript
> functions. Thus, leaving my global variables empty.
>
> Do you have any suggestions on how this could be fixed? I am trying
> setTimeOut() at the moment but i would be glad to concider other
> solutions as well..
>
> I could provide code examples on request.
>
> Thanks in advance!
>


[jQuery] Re: Paste an image into a tag...

2009-09-18 Thread Dan G. Switzer, II
It's been a while since I've looked at either TinyMCE or FCKEditor (now
CKEditor) but non of the WYSIWYG editors based on the browser can do what
Hogsmill wants.
In order to paste an image from the clipboard, you'll need something that
can also upload the image to the server on the paste operation.

The product I've used in the past to accomplish this is XStandard--which
comes as either a Firefox add-on and an ActiveX control for IE. It does
require an client installation, but it's a very powerful XHTML-based editor
and works really well for us.

The images are uploaded to the server via a web service on the paste
operation--it even handles multiple images in the clipboard. We choose
XStandard, because users could copy an entire Word document into the
clipboard with multiple images and simply paste it into the XStandard editor
and the content would get pasted complete with all the images in the Word
document.

There are some Java-based rich text editor controls I found too, but they
were all much more expensive.

Also, if you *only* care about pasting a single image (and don't really need
the whole rich text portion) you could write a signed Java applet to do
this. For our help desk application, I wrote a signed Java applet that would
either take the screenshot for the user or allow pasting an image from the
clipboard to add as an attachment. I can't share the code, but it's
relatively straightforward (the biggest issue is handling clipboard
operations on the Mac.)

-Dan

On Fri, Sep 18, 2009 at 9:22 AM, Peter Edwards  wrote:

>
> Have you thought of using a rich text editor to do this such as
> TinyMCE and FCKEditor - they both have paste from clipboard
> functionality
>
> On Fri, Sep 18, 2009 at 11:12 AM, Hogsmill  wrote:
> >
> > This may or may not be possible, but if anyone knows a way to do it,
> > I'd love to hear from you.
> >
> > Basically, I simply (?) want to copy an image (e.g. from ALT-Print
> > Screen or 'Copy Image'), and paste/drop it into an img tag on a page
> > so it appears on the page. I can then resize, drag-drop, etc. as
> > required.
> >
> > I've had a rummage around the net, but can't find anything. Maybe it's
> > impossible?
> >
> > Cheers,
> >
> > Steve
> >
>


[jQuery] Re: load with callback confusion

2009-09-18 Thread Dan G. Switzer, II
The second argument for the load() function is "data", not "callback":
http://docs.jquery.com/Ajax/load#urldatacallback

Do this instead:

 $("span#mycontent").load("mytext.txt", {}, function(){
  // callback code here
});

-Dan

On Fri, Sep 18, 2009 at 5:51 AM, geegler  wrote:

>
> How come this code doesn't work?
>
> $("span#myinfo").mouseover(function(){
>$("span#mycontent").load("mytext.txt",function(){
>var soffset = $(this).offset();
>var stop = soffset.top;
>var ihgt = $("div#footer").css("height");
>var mtop = $("div#mydiv").css("top");
>var mhgt = $("div#mydiv").outerHeight() + 50;
>var ntop = stop - mhgt;
>$("div#mydiv").css("top",ntop);
>$("div#mydiv").fadeIn("slow");
>});
> });
>
> This version works but, I don't want to display the div element until
> the small text file has completed loading.
>
> $("span#myinfo").mouseover(function(){
>$("span#mycontent").load("mytext.txt");
>var soffset = $(this).offset();
>var stop = soffset.top;
>var ihgt = $("div#footer").css("height");
>var mtop = $("div#mydiv").css("top");
>var mhgt = $("div#mydiv").outerHeight() + 50;
>var ntop = stop - mhgt;
>$("div#mydiv").css("top",ntop);
>$("div#mydiv").fadeIn("slow");
> });
>


[jQuery] Re: New iPhone-style button plug-in released...

2009-09-04 Thread Dan G. Switzer, II
Keyboard support is often overlooked, but it's always high on our priority
list because many of our users are very keyboard centric and don't like
using the mouse at all.

On Fri, Sep 4, 2009 at 12:23 PM, Dave Methvin wrote:

>
> > We've just released another jQuery plug-in which emulates the
> iPhone-style
> > button used to toggle settings on/off.
>
> Very nice, Dan. I like the way you haven't forgotten keyboard access.
>


[jQuery] New iPhone-style button plug-in released...

2009-09-04 Thread Dan G. Switzer, II
We've just released another jQuery plug-in which emulates the iPhone-style
button used to toggle settings on/off. The plug-in works with both checkbox
and radio button groups and we've worked hard to make this a complete
plug-in. While there are several similar plug-ins, we couldn't find one that
actually had all the features we needed--which is why we built this version.
http://www.givainc.com/labs/ibutton_jquery_plugin.htm

You can see a demo here:
http://www.givainc.com/labs/ibutton_example.htm

Here are the features:

   - Works with checkboxes or radio elements
   - Full keyboard support — use the [TAB] key to move from field to field
   and use the spacebar to toggle the status of the iButton (or use the arrow
   keys for radio buttons)
   - Custom event handlers
   - Detach iButton behavior from the element
   - Metadata support — when used with the jQuery Metadata
Plug-in,
   you can define the properties for your button completely within the class
   attribute of your input elements
   - Enable/disable drag support — while the dragging behavior is intuitive
   on touch-based devices, it's not always be the best or expected UI behavior
   and may cause some mouse users problems (NOTE: In order to help
   differentiate between an intended mouse click or an actual drag event, we're
   developed the clickOffset option. If the time (in milliseconds) is under
   this value (120ms by default) it's assumed the user was attempting to click
   the button and not drag the handle.)
   - Enable/disable animation
   - Single sprite image — easily change the look of your button by just
   replacing the image sprite
   - Customizable labels — use any labels you want for your buttons
   - Support for disabled buttons
   - Easing support for animations
   - iPhone support

Hopefully some of you find this useful.

-Dan


[jQuery] Re: input has focus

2009-08-10 Thread Dan G. Switzer, II
You can add a class to your field when it has focus and then check for the
class:
$(":input")
// add focus/blur events
.focus(function (){
$(this).addClass("has-focus");
})
.blur(function (){
$(this).removeClass("has-focus");
});

Now you can just do $("input#1").is(".has-focus") to check if it has focus.

-Dan

On Mon, Aug 10, 2009 at 3:20 PM, MartinBorthiry
wrote:

>
> Hello:
>
>  I'm trying to know if an input has focus. Is that possible using
> jquery?
>
>  samething like this:
>
>   $('input#1').has_focus()
>


[jQuery] Re: Filter List Items w/ Sub-Lists

2009-08-05 Thread Dan G. Switzer, II
Try:

$('.start-here li').filter(':has(ul)').append('');

-Dan

On Wed, Aug 5, 2009 at 11:59 AM, Panman  wrote:

>
> I have selected a list that contains sub-lists. Now, I'd like to
> search for the list items that contain sub-lists (but not including
> the sub-list-items). I think the example below will explain what I'm
> trying to do.
>
> HTML:
> 
>  Do Not Need
>  NEED THIS ITEM
>
>  Do Not Need
>  Do Not Need
>
>  
>  Do Not Need
>  NEED THIS ITEM
>
>  Do Not Need
>  Do Not Need
>  NEED THIS ITEM
>
>  Do Not Need
>  Do Not Need
>
>  
>  Do Not Need
>
>  
>  Do Not Need
> 
>
> jQuery:
> $('.start-here li').filter(':has(li)').append('');
>
> The above jQuery statement selects the correct  but also all child
> 's, which I do not want.
>


[jQuery] Re: [Linkselect] Change function fires when using "replaceOptions"

2009-08-05 Thread Dan G. Switzer, II
skube,
This is not a limitation, but a specific design decision. If you're
replacing the options in a select box you are in affect also changing the
value (or at least potentially changing) the value since you now have a
completely new set of values in the box.

Therefore, to ensure that dependency attached to the behavior are correctly
carried through the change callback is fired.

For example, let's say had 3 linkselects in your chain. Select 1 changes the
options in Select 2 and Select 2 changes the options in Select 3. When you
change the value in Select 1, the options in Select 2 will change, however
the options in Select 3 will also correctly change to reflect the new value
in Select 2.

However, if you *really* need to avoid the callback from running, the
replaceOptions() method does have a second argument you can set to false for
preventing the change callback from running. However, this really should be
the exception to the rule and should only be used if you're going to end up
with some kind of circular logic.

-Dan

On Tue, Aug 4, 2009 at 2:54 PM, skube  wrote:

>
> Ok, I think I have one last outstanding problem with Giva Labs'
> awesome Linkselect plug-in. I'm wondering if it is a limitation of the
> plug-in or if I am simply doing something wrong.
>
> I am using one select to update another and everything works
> perfectly. However, I am finding the "change" function fires when I
> use "replaceOptions" to update the second select even though I'm
> simply re-initiating the second select with a new set of options. I
> think the "change" function should only fire when I do I physically
> select another option in the second select and not every time I update
> the first select.
>
> I've recreated a cut/paste demo to illustrate the point below. As you
> can see, the alert occurs when changing either the first or second
> select.
>
>
> 
>  www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> 
>  Test
>
>http://ajax.googleapis.com/ajax/
> libs/jquery/1.2.6/jquery.min.js">
>http://www.givainc.com/labs/lib/
> jquery.linkselect.js">
>http://www.givainc.com/labs/lib/
> jquery.bgiframe.js">
>
>http://www.givainc.com/labs/css/
> jquery.linkselect.css" rel="stylesheet" title="default" media="all" /
> >
>http://www.givainc.com/labs/css/
> jquery.linkselect.style.select.css" rel="alternate stylesheet"
> title="select" media="all" />
>
>  
>$(function(){
>
>$("#one").linkselect({
>change: function(){
>$("#two").linkselect("replaceOptions",
> [{value:"1",text:"asdf"}, {value:"2",text:"qwer"}]);
>}
>});
>
>$("#two").linkselect({
>change: function(){
>alert('fired prematurely');
>}
>});
>
>});
>  
>
> 
> 
>
>option 1-1
>option 1-2
>option 1-3
>
>
>option 2-1
>option 2-2
>option 2-3
>
>
>
>
> 
>


[jQuery] Re: [linkselect] Positioning menus off bottom of window

2009-08-04 Thread Dan G. Switzer, II
Sherri,
You can use the open callback to handle repositioning the container if you
wish. The callback gets 4 arguments: $container, $a, $selected, $title

The $container argument is a jQuery object referencing the dropdown. You
could just offset it's top position by XXX amount to move the box up.

-Dan

On Mon, Aug 3, 2009 at 10:07 AM, Sherri  wrote:

>
> Hi all,
>
> I'm working on a website where we're using the jquery.linkselect
> plugin, and we're running into a situation where we have one of the
> dropdown linkselect menus happening near the very bottom of the users'
> window.  Imagine that we have a list of articles with abstracts,
> authors, etc. running down the left hand side in a div which is set to
> show a scrollbar if the results list gets long, and each article has a
> linkselect dropdown menu.
>
> Unexpectedly, if you've scrolled to the bottom of the scrolling div
> and you're on the last item in the list, linkselect is allowing the
> menu to drop down extending past the bottom of the scrolling div and
> outside the boundary of the browser window.  This is problematic, as
> it makes the menu items inaccessible.
>
> We're looking for a way to have it automatically detect the bottom of
> the screen and reposition the menu accordingly (similarly to the way
> it does it to make sure it doesn't get positioned off the right hand
> side of the screen).  I might be able to hack it, but was hoping maybe
> the linkselect team might be able to put something in more quickly and
> efficiently than I can.  :)
>
> Alternately, a way to specify that a menu drops up rather than drops
> down would also be a great solution to our situation (I didn't see
> that in the options, though please let me know if I missed it).
>
> Thanks in advance for any help,
>
> --Sherri
>
>


[jQuery] Re: Linkselect Plugin Woes

2009-07-30 Thread Dan G. Switzer, II
The title attribute isn't required--it's optional. However, we use it as a
hint in the dropdown to provide the user with some form of instruction.

On Thu, Jul 30, 2009 at 4:37 PM, skube  wrote:

>
> Oh and I didn't clue into the missing title attribute since my page
> was validating fine using Tidy.
>
> On Jul 30, 4:29 pm, skube  wrote:
> > N/m I now see the page has been updated with version 1.2.08.
> >
> > Thanks Dan! This was frustrating the heck out of me. :)
>


[jQuery] Re: Linkselect Plugin Woes

2009-07-30 Thread Dan G. Switzer, II
skubie,
I've fixed the problem. The error was in the repaint() method--which was
expecting that the  element had a title attribute.

I've uploaded a fixed version of the plug-in:
http://www.givainc.com/labs/linkselect_jquery_plugin.htm

Let me know how the new version works out for you.

-Dan

(BTW - I recommend looking into adding a title attribute to your select tag,
it can make the linkselect a little more user-friendly.)

On Thu, Jul 30, 2009 at 11:35 AM, skube  wrote:

>
> Here is a distilled (cut and paste) version of the code. Only the
> plugin is not supplied.
> The error that is coming up is I[0] is undefined
>
>
> 
>  www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> 
>Test
>
>a.linkselectLink {text-decoration:none; display:block;}
>.linkselectContainer {position: absolute;   left: 0; top: 0;
> display: none;  max-width: 500px;   }
>.linkselectContainer .scrollable {width: auto;  background-
> color: white;   text-align: left;   overflow: auto; max-height: 216px;
> clear: both;}
>.linkselectContainer ul {margin: 0px;   padding: 0px;}
>
>http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/
> jquery.min.js" type="text/javascript">
> script>
>