[jQuery] Re: animate callback scope for infinite loop?

2009-06-07 Thread mkmanning

The above post fails due to this:

obj.animate({ opacity:myOpacity}, 500);
animation();

The animation() function will be called immediately each time. It
should be in obj.animate's callback function. That being said, the OP
was asking how to do this without resorting to setTimeout().

To do that, in your Animation function just set a var to 'this':

 var Animation = function(elementID){
var _this = this;
this.opa = 1;
this.floatAround = function(){
...

then refer to it in your callback:

if(startStop == 1){
  _this.floatAround(); //won't work, because this no longer
points
to the Animation object, but this is what I want to do.
}


On Jun 7, 10:02 pm, waseem sabjee  wrote:
> var obj = $("div"):
> // i want my objects opacity to go to 1 to 0.6 then follow that pattern
>
> var animeframe = 0;
> var myOpacity;
>
> function animation() {
> setTimeout(function() {
> if(animeframe == 0) {
> myOpacity = 0.6;
> animeframe = 1;} else if(animeframe  == 1) {
>
> myOpacity = 1;
> animeframe  = 0;}
>
> obj.animate({ opacity:myOpacity}, 500);
> animation();
>
> }, 1000);
> }
>
> The Above  animation function has some code wrapped in a setTimeout
> recalling the function after x seconds
> I then access my variable to define to which frame the animation should be
> on and what the properties are to set for that frame.
> i then do the animation and recall the function
> This will loop endlessly between frame one and two as the end can never me
> achieved.
>
> On Mon, Jun 8, 2009 at 3:11 AM, Bill  wrote:
>
> > I think you may have misunderstood what I am trying to do.  I need to
> > refer to the instance of the Animation object.  Within the callback,
> > "this" already refers to the HTML Element.
>
> > On Jun 7, 4:40 pm, Gustavo Salomé  wrote:
> > > try
> > > $this=$(elementID);
>
> > > 2009/6/7 Bill 
>
> > > > Hi,
>
> > > > I'm trying to create an endless animation similar to a screen saver,
> > > > where an image floats around the screen, fading in and out.  I would
> > > > like to stay out of the global namespace, so I'd like to use the
> > > > callback to animate() rather than getTimeout(), which seems to operate
> > > > only on functions in the global namespace.  Please correct me if I'm
> > > > wrong about that.
>
> > > > But I'm having trouble maintaining the scope I want for the callback
> > > > -- I want "this" to refer to my Animation object, not the HTML
> > > > element.  I understand many folks have solved this problem for events
> > > > by using bind() or live(), but I am wondering how to do this for
> > > > animate().
>
> > > > Here is my code:
>
> > > > $(document).ready(function(){
>
> > > >        var startStop = 1;
>
> > > >        //object for creating animated elements that fade in or out
> > while
> > > > moving to a random point.
> > > >        var Animation = function(elementID){
> > > >                this.opa = 1;
> > > >                this.floatAround = function(){
> > > >                    var top = Math.random() * $('#content').height();
> > > >                    var left = Math.random() * $('#content').width();
> > > >                        $(elementID).animate(
> > > >                                        {       opacity:(this.opa),
> > > >                                                marginTop:top+'px',
> > > >                                                marginLeft:left+'px'
> > > >                                        },
> > > >                                        1000,
> > > >                                        'linear',
> > > >                                        this.callback
> > > >                        );
> > > >                        this.opa = this.opa > 0 ? 0 : 1;
> > > >                };
> > > >                this.callback = function(){
> > > >                        //alert(this); //HTML Image Element -- not what
> > I
> > > > want.
> > > >                        if(startStop == 1){
> > > >                                //this.floatAround(); //won't work,
> > because
> > > > this no longer points
> > > > to the Animation object, but this is what I want to do.
> > > >                        }
> > > >                };
> > > >        };
>
> > > >        //user may click on the containing div to stop the animation.
> > > >        $('#content').toggle(
> > > >                function(){
> > > >                        startStop = 0;
> > > >                },
> > > >                function(){
> > > >                        startStop = 1;
> > > >                        //floater.floatAround(); //...and maybe start it
> > > > again.
> > > >                }
> > > >        );
>
> > > >        //start the animation
> > > >        var floater = new Animation('#animate_me');
> > > >        floater.floatAround();
> > > > });
>
> > > > thanks for any help in advance!
>
> > > --
> > > Gustavo Salome Silva


[jQuery] Make Learning Jquery Accordian Work With Unordered List

2009-06-07 Thread followerofjesus

Hello, I was wondering how to make 
http://www.learningjquery.com/2007/03/accordion-madness
by Karl, work with an unordered lis instead of divs. I tried the below
but did not work. I think what I have done here ('.links:visible');
looks plain wrong (I can't put a class or an Id in there right??)

$(document).ready(function() {

 $('.links').hide();

$('.category').click(function() {

var $nexto = $(this).next();

var $visibleSiblings = $nexto.siblings('.links:visible');

if ($visibleSiblings.length ) { $visibleSiblings.slideUp('fast',
function() {$nexto.slideToggle('fast'); });
} else {
$nexto.slideToggle('fast');
 }
 });
 });

The HTML:


Web Packages and Services

How do you do
How are you going
Have a good day
Testing testing
Good day to you


Web Packages and Services

How do you do
How are you going
Have a good day
Testing testing
Good day to you





[jQuery] Superfish IE6 and IE7 failures

2009-06-07 Thread Jeremy Schultz

I'm having two issues with Superfish in IE6 and IE7:

1. It doesn't work at all in IE6, though it appears from other posts
that this is to be expected. Is there any way for it to degrade more
gracefully and have some functionality?

2. In IE7 the menus show up fine but disappear instantly when the
mouse leaves the top level menu item.

Not sure what to do at this point. Here's the link:

http://www.jeremyschultz.com/client/orchardplace/website/beta/

Jeremy


[jQuery] Re: animate callback scope for infinite loop?

2009-06-07 Thread waseem sabjee
var obj = $("div"):
// i want my objects opacity to go to 1 to 0.6 then follow that pattern

var animeframe = 0;
var myOpacity;

function animation() {
setTimeout(function() {
if(animeframe == 0) {
myOpacity = 0.6;
animeframe = 1;
} else if(animeframe  == 1) {
myOpacity = 1;
animeframe  = 0;
}
obj.animate({ opacity:myOpacity}, 500);
animation();
}, 1000);
}

The Above  animation function has some code wrapped in a setTimeout
recalling the function after x seconds
I then access my variable to define to which frame the animation should be
on and what the properties are to set for that frame.
i then do the animation and recall the function
This will loop endlessly between frame one and two as the end can never me
achieved.


On Mon, Jun 8, 2009 at 3:11 AM, Bill  wrote:

>
> I think you may have misunderstood what I am trying to do.  I need to
> refer to the instance of the Animation object.  Within the callback,
> "this" already refers to the HTML Element.
>
>
> On Jun 7, 4:40 pm, Gustavo Salomé  wrote:
> > try
> > $this=$(elementID);
> >
> > 2009/6/7 Bill 
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > I'm trying to create an endless animation similar to a screen saver,
> > > where an image floats around the screen, fading in and out.  I would
> > > like to stay out of the global namespace, so I'd like to use the
> > > callback to animate() rather than getTimeout(), which seems to operate
> > > only on functions in the global namespace.  Please correct me if I'm
> > > wrong about that.
> >
> > > But I'm having trouble maintaining the scope I want for the callback
> > > -- I want "this" to refer to my Animation object, not the HTML
> > > element.  I understand many folks have solved this problem for events
> > > by using bind() or live(), but I am wondering how to do this for
> > > animate().
> >
> > > Here is my code:
> >
> > > $(document).ready(function(){
> >
> > >var startStop = 1;
> >
> > >//object for creating animated elements that fade in or out
> while
> > > moving to a random point.
> > >var Animation = function(elementID){
> > >this.opa = 1;
> > >this.floatAround = function(){
> > >var top = Math.random() * $('#content').height();
> > >var left = Math.random() * $('#content').width();
> > >$(elementID).animate(
> > >{   opacity:(this.opa),
> > >marginTop:top+'px',
> > >marginLeft:left+'px'
> > >},
> > >1000,
> > >'linear',
> > >this.callback
> > >);
> > >this.opa = this.opa > 0 ? 0 : 1;
> > >};
> > >this.callback = function(){
> > >//alert(this); //HTML Image Element -- not what
> I
> > > want.
> > >if(startStop == 1){
> > >//this.floatAround(); //won't work,
> because
> > > this no longer points
> > > to the Animation object, but this is what I want to do.
> > >}
> > >};
> > >};
> >
> > >//user may click on the containing div to stop the animation.
> > >$('#content').toggle(
> > >function(){
> > >startStop = 0;
> > >},
> > >function(){
> > >startStop = 1;
> > >//floater.floatAround(); //...and maybe start it
> > > again.
> > >}
> > >);
> >
> > >//start the animation
> > >var floater = new Animation('#animate_me');
> > >floater.floatAround();
> > > });
> >
> > > thanks for any help in advance!
> >
> > --
> > Gustavo Salome Silva
>


[jQuery] Re: document.body is null or is not an object

2009-06-07 Thread Lideln

Hi,

Thank you all for your answers !

The problem is, that nobody else got this error, just me. And the
other problem is that neither Firebug or WebDeveloper tell me of
errors (they both detect different errors sometimes). IE6 bugs only on
this line, and I tried to comment the inclusion of the two jquery
plugins I am using, with no success.
The problem does not seem to occur in IE7.

I reverted all my changes and it still does not work... It's really
confusing !

I will try today, but if someone has an idea, or got this error and
found out why, I would be glad to hear because I really tried a lot of
things to make it work...

Thanks,

Lideln


On 7 juin, 05:47, Ricardo  wrote:
> That's a check for proper W3C box model support, as you can see it
> runs on document.ready (jQuery(function...), so it's impossible that
> the document body doesn't exist yet. Kranti is right, it's likely a
> previous error that's causing it.
>
> On Jun 5, 9:07 am, Lideln  wrote:
>
> > Hi !
>
> > I have an issue... What is weird, is that my colleagues don't have
> > it ! (and I did not have it this morning)
> > It happens only on IE6... Everything is fine under Firefox (3), Safari
> > (4 beta) and Opera (9.64).
>
> > When logging in into my application, IE tells me "document.body is
> > null or is not an object".
> > I have the IE6 debugger installed, and it points me toward : (I used
> > the "normal" jquery version to show the plain text code)
>
> > [code]
> > // Figure out if the W3C box model works as expected
> > // document.body must exist before we can do this
> > jQuery(function(){
> >         var div = document.createElement("div");
> >         div.style.width = div.style.paddingLeft = "1px";
>
> >         document.body.appendChild( div ); <--- error happens here
> >         jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
> >         document.body.removeChild( div ).style.display = 'none';});
>
> > [/code]
>
> > How can this be possible ?
>
> > Thank you for any possible lead that could help me get rid of this
> > error...
>
> > Kind regards,


[jQuery] Re: Newbie: jQuery performance with 1000s of form elements

2009-06-07 Thread ravi


[apologies for the self-response]

On Jun 7, 2009, at 11:08 PM, Ravi Narayan Sarma wrote:


In the hope that a public recounting of my adventures will be of  
some edifying value, perhaps in the archives, an update:




Some details that I forgot to add. I used Safari/WebKit's profiler to  
see what was going on with my app. Since my app first loads the entire  
200+ row table using JavaScript, I did not start the profiler until  
after that loading was complete (since I am not, right now, interested  
in performance issues during initial load). What emerged once I  
started the profiler was that a large amount of time 60+% was spent in  
livequery() related activities. Which surprised my naive  
understanding: I had presumed that livequery() worked magically by  
watching the DOM (somehow!) and upon addition of an element with a  
matching selector (that livequery() had been configured to act upon),  
it attached the corresponding event to that element. By this  
understanding, livequery() should have no part to play once the DOM  
was loaded up and ready to go. Clearly, my understanding is wrong,  
somewhere.


Anyway, a couple of additional links that discuss Event Delegation and  
the clone(true) approach:


http://www.learningjquery.com/2008/03/working-with-events-part-1
http://www.learningjquery.com/2008/05/working-with-events-part-2

--ravi



=
Background:

My problem: performance of my newbie jQuery based app with a table  
with 100s of rows consisting of 1000s of form elements slowed to an  
unusable level when the number of rows crossed about 200. I have  
been struggling to figure out how to overcome the problem. One  
obvious option is to redesign a UI that consists of 1000s of form  
elements ;-). Other options?


My entire table is created dynamically on load using AJAX GETs. I  
clone a template row that is hidden in the page to add rows to the  
table. I use livequery() (the plugin) to add event handlers to form  
elements in each row.

=

One option that I came across was to call clone(true) when adding my  
table rows, so that I do not rely on livequery() to attach event  
triggers (see http://bit.ly/Y6ZFe for one livequery() performance  
discussion). That's the one I am currently exploring.


However, the more I read, the more it seems that Event Delegation (http://bit.ly/Wr3Gr 
) is really the safest approach, though it nullifies a good bit of  
the advantages of using jQuery like syntax/constructs to add event  
handlers. For those who are even more newbie than I am (if such is  
possible), Event Delegation is the idea that you do not add event  
handlers to each little DOM element of interest, but instead, you  
let those mouseclicks and what not "bubble" up, and then use if()  
style checking at some high-level to figure out the element that has  
been clicked on and act accordingly.


I will complete my code changes to replace my use of livequery()  
with clone(true), just to see the effect on performance. Once I have  
that information, I will most likely switch to an Event Delegation  
approach for the bulk of my event handlers. I will report back with  
my findings.


In the meantime, if any list guru has advice for me that would  
alleviate my stumbling around like a goof, I am gratefully receptive  
to it!


--ravi






[jQuery] jCarousel infinite loop aborting

2009-06-07 Thread Alan Gutierrez


I found an old thread where this was discussed...

http://groups.google.com/group/jquery-en/browse_frm/thread/41b01c1c21f61934/0e6da863d9e26a2a?lnk=gst&q=jcarousel+infinite#0e6da863d9e26a2a

For those of you facing the message 'jCarousel: No width/height set  
for items. This will cause an infinite loop. Aborting...' in IE 7,  
even when jCarousel is working in FF and Safari, the problem has to do  
with IE 7 resizing. When the jCarousel recalculates itself as a result  
of a resize of page reflow it can't get width and height for the list  
items for some strange reason.


Rather than comment out the onresize logic, I just delayed it to run  
after the page reflowed.


I changed this line:

  this.funcResize = function() { self.reload(); };

to this line:

  this.funcResize = function() { setTimeout( function()  
{ self.reload(); }, 100 ) };


and everything is fine in IE 7.

Alan Gutierrez



[jQuery] Problem with looping autocomplete

2009-06-07 Thread Joe Tseng
I've tried every possible combination I can think of so I hope someone here
can see something I'm missing...  I have a form with multiple line items and
I want to have a few of the fields validated against my database to make
sure the values exist.  My code is as follows:

I've got a select form element to pick a department:



  
#name#

  

...

I loop to create an initial ten blank line items:



  
  
...

  

...


var methodURL = 'http://#CGI.HTTP_HOST#/';

$(document).ready(function() {
function checkValue(li) {
alert($('#job1').val());
}

for (var i=1;i<=10;i++) {
The first autocomplete finds valid job numbers based on the dept selected

$('#job'+i).autocomplete(methodURL,
{
 minChars:4
,timeout:3000
,matchContains:1
,cacheLength:1
,extraParams:{
 'fuseaction':'j.jobnumber_autocomplete'

,'company':document.getElementById('dept0').options[document.getElementById('dept0').selectedIndex].text
}
}
);

The 2nd autocomplete finds valid elements based on the 1st job number found:

$('#elem'+i).autocomplete(methodURL,
{
 minChars:1
,timeout:3000
,matchContains:1
,cacheLength:1
,onItemSelect:checkValue
,extraParams:{
 'fuseaction':'j.elements_autocomplete'
,'jobno':$('#job'+i).val()
}
}
);

}
});
}

My problem is that the 2nd autocomplete queries and returns valid values but
does not seem to pass my 2nd parameter (jobno).  The record from my web
server access log is as follows:
q=95&fuseaction=j.elements_autocomplete&jobno=
Jobnumber should have a large integer value (eg 100245100).

What irritates me is that my 1st autocomplete works perfectly but the 2nd
one doesn't no matter what I try (even if I replace '#job'+i with 'job1').
I am desperate for any useful insight...


tia,

 - Joe

-- 

Failure is always an option -- Adam Savage


[jQuery] Re: Newbie: jQuery performance with 1000s of form elements

2009-06-07 Thread ravi



In the hope that a public recounting of my adventures will be of some  
edifying value, perhaps in the archives, an update:


=
Background:

My problem: performance of my newbie jQuery based app with a table  
with 100s of rows consisting of 1000s of form elements slowed to an  
unusable level when the number of rows crossed about 200. I have been  
struggling to figure out how to overcome the problem. One obvious  
option is to redesign a UI that consists of 1000s of form  
elements ;-). Other options?


My entire table is created dynamically on load using AJAX GETs. I  
clone a template row that is hidden in the page to add rows to the  
table. I use livequery() (the plugin) to add event handlers to form  
elements in each row.

=

One option that I came across was to call clone(true) when adding my  
table rows, so that I do not rely on livequery() to attach event  
triggers (see http://bit.ly/Y6ZFe for one livequery() performance  
discussion). That's the one I am currently exploring.


However, the more I read, the more it seems that Event Delegation (http://bit.ly/Wr3Gr 
) is really the safest approach, though it nullifies a good bit of the  
advantages of using jQuery like syntax/constructs to add event  
handlers. For those who are even more newbie than I am (if such is  
possible), Event Delegation is the idea that you do not add event  
handlers to each little DOM element of interest, but instead, you let  
those mouseclicks and what not "bubble" up, and then use if() style  
checking at some high-level to figure out the element that has been  
clicked on and act accordingly.


I will complete my code changes to replace my use of livequery() with  
clone(true), just to see the effect on performance. Once I have that  
information, I will most likely switch to an Event Delegation approach  
for the bulk of my event handlers. I will report back with my findings.


In the meantime, if any list guru has advice for me that would  
alleviate my stumbling around like a goof, I am gratefully receptive  
to it!


--ravi




[jQuery] Re: animate callback scope for infinite loop?

2009-06-07 Thread Bill

I think you may have misunderstood what I am trying to do.  I need to
refer to the instance of the Animation object.  Within the callback,
"this" already refers to the HTML Element.


On Jun 7, 4:40 pm, Gustavo Salomé  wrote:
> try
> $this=$(elementID);
>
> 2009/6/7 Bill 
>
>
>
>
>
> > Hi,
>
> > I'm trying to create an endless animation similar to a screen saver,
> > where an image floats around the screen, fading in and out.  I would
> > like to stay out of the global namespace, so I'd like to use the
> > callback to animate() rather than getTimeout(), which seems to operate
> > only on functions in the global namespace.  Please correct me if I'm
> > wrong about that.
>
> > But I'm having trouble maintaining the scope I want for the callback
> > -- I want "this" to refer to my Animation object, not the HTML
> > element.  I understand many folks have solved this problem for events
> > by using bind() or live(), but I am wondering how to do this for
> > animate().
>
> > Here is my code:
>
> > $(document).ready(function(){
>
> >        var startStop = 1;
>
> >        //object for creating animated elements that fade in or out while
> > moving to a random point.
> >        var Animation = function(elementID){
> >                this.opa = 1;
> >                this.floatAround = function(){
> >                    var top = Math.random() * $('#content').height();
> >                    var left = Math.random() * $('#content').width();
> >                        $(elementID).animate(
> >                                        {       opacity:(this.opa),
> >                                                marginTop:top+'px',
> >                                                marginLeft:left+'px'
> >                                        },
> >                                        1000,
> >                                        'linear',
> >                                        this.callback
> >                        );
> >                        this.opa = this.opa > 0 ? 0 : 1;
> >                };
> >                this.callback = function(){
> >                        //alert(this); //HTML Image Element -- not what I
> > want.
> >                        if(startStop == 1){
> >                                //this.floatAround(); //won't work, because
> > this no longer points
> > to the Animation object, but this is what I want to do.
> >                        }
> >                };
> >        };
>
> >        //user may click on the containing div to stop the animation.
> >        $('#content').toggle(
> >                function(){
> >                        startStop = 0;
> >                },
> >                function(){
> >                        startStop = 1;
> >                        //floater.floatAround(); //...and maybe start it
> > again.
> >                }
> >        );
>
> >        //start the animation
> >        var floater = new Animation('#animate_me');
> >        floater.floatAround();
> > });
>
> > thanks for any help in advance!
>
> --
> Gustavo Salome Silva


[jQuery] Re: animate callback scope for infinite loop?

2009-06-07 Thread Gustavo Salomé
try
$this=$(elementID);

2009/6/7 Bill 

>
> Hi,
>
> I'm trying to create an endless animation similar to a screen saver,
> where an image floats around the screen, fading in and out.  I would
> like to stay out of the global namespace, so I'd like to use the
> callback to animate() rather than getTimeout(), which seems to operate
> only on functions in the global namespace.  Please correct me if I'm
> wrong about that.
>
> But I'm having trouble maintaining the scope I want for the callback
> -- I want "this" to refer to my Animation object, not the HTML
> element.  I understand many folks have solved this problem for events
> by using bind() or live(), but I am wondering how to do this for
> animate().
>
> Here is my code:
>
> $(document).ready(function(){
>
>var startStop = 1;
>
>//object for creating animated elements that fade in or out while
> moving to a random point.
>var Animation = function(elementID){
>this.opa = 1;
>this.floatAround = function(){
>var top = Math.random() * $('#content').height();
>var left = Math.random() * $('#content').width();
>$(elementID).animate(
>{   opacity:(this.opa),
>marginTop:top+'px',
>marginLeft:left+'px'
>},
>1000,
>'linear',
>this.callback
>);
>this.opa = this.opa > 0 ? 0 : 1;
>};
>this.callback = function(){
>//alert(this); //HTML Image Element -- not what I
> want.
>if(startStop == 1){
>//this.floatAround(); //won't work, because
> this no longer points
> to the Animation object, but this is what I want to do.
>}
>};
>};
>
>//user may click on the containing div to stop the animation.
>$('#content').toggle(
>function(){
>startStop = 0;
>},
>function(){
>startStop = 1;
>//floater.floatAround(); //...and maybe start it
> again.
>}
>);
>
>//start the animation
>var floater = new Animation('#animate_me');
>floater.floatAround();
> });
>
> thanks for any help in advance!
>



-- 
Gustavo Salome Silva


[jQuery] Re: Tooltip placement

2009-06-07 Thread Gustavo Salomé
*width*change the hover function to get the object width and remove the
mousemove function.
Do somenthing like:
this.tooltip = function(){
   /* CONFIG */
   xOffset = 20;
   yOffset = 50;
   // these 2 variable determine popup's distance from the
cursor
   // you might want to adjust to get the right result
   /* END CONFIG */
   $("a.tooltip").hover(function(e){
   this.t = this.title;
*   width=$(this).width();*
   this.title = "";
   $("body").append(""+ this.t +"");
   $("#tooltip")
   .css("top",(e.pageY - xOffset) + "px")
   .css("left",(e.pageX + *width* + 10) + "px")
   .fadeIn("600");
   },
   function(){
   this.title = this.t;
   $("#tooltip").remove();
   });
};

2009/6/7 ivanisevic82 

>
> Hi! Sorry for my english, I hope you understand me.
> I'm using a tooltip created with Jquery, this is the code:
> _
>
> this.tooltip = function(){
>/* CONFIG */
>xOffset = 20;
>yOffset = 50;
>// these 2 variable determine popup's distance from the
> cursor
>// you might want to adjust to get the right result
>/* END CONFIG */
>$("a.tooltip").hover(function(e){
>this.t = this.title;
>this.title = "";
>$("body").append(""+ this.t +"");
>$("#tooltip")
>.css("top",(e.pageY - xOffset) + "px")
>.css("left",(e.pageX + yOffset) + "px")
>.fadeIn("600");
>},
>function(){
>this.title = this.t;
>$("#tooltip").remove();
>});
>$("a.tooltip").mousemove(function(e){
>$("#tooltip")
>.css("top",(e.pageY - xOffset) + "px")
>.css("left",(e.pageX + yOffset) + "px");
>});
> };
>
>
>
> // starting the script on page load
> $(document).ready(function(){
>tooltip();
> });
>
> 
>
> If you want to see a preview go in this link and with the mouse over
> the image on top-right.
>
> http://www.ivanisevic82.com/pages/prova-8.php
>
> So, my problem is this: i'd like to place the tooltip in a different
> place: not with a relative position (relative to che mouse, the
> tooltip moves whit it, as you can see in the preview) but an absolute
> position.
> I would like that the tooltip stay fixed on the right of the image,
> and without moving if I move the mouse.
>
> How can I do it?
> Can I change the jquery code and "say" to it that the position of the
> tooltip has to be definied in the css part of my site?
>
> Thank you!
>
> Bye!
>



-- 
Gustavo Salome Silva


[jQuery] animate callback scope for infinite loop?

2009-06-07 Thread Bill

Hi,

I'm trying to create an endless animation similar to a screen saver,
where an image floats around the screen, fading in and out.  I would
like to stay out of the global namespace, so I'd like to use the
callback to animate() rather than getTimeout(), which seems to operate
only on functions in the global namespace.  Please correct me if I'm
wrong about that.

But I'm having trouble maintaining the scope I want for the callback
-- I want "this" to refer to my Animation object, not the HTML
element.  I understand many folks have solved this problem for events
by using bind() or live(), but I am wondering how to do this for
animate().

Here is my code:

$(document).ready(function(){

var startStop = 1;

//object for creating animated elements that fade in or out while
moving to a random point.
var Animation = function(elementID){
this.opa = 1;
this.floatAround = function(){
var top = Math.random() * $('#content').height();
var left = Math.random() * $('#content').width();
$(elementID).animate(
{   opacity:(this.opa),
marginTop:top+'px',
marginLeft:left+'px'
},
1000,
'linear',
this.callback
);
this.opa = this.opa > 0 ? 0 : 1;
};
this.callback = function(){
//alert(this); //HTML Image Element -- not what I want.
if(startStop == 1){
//this.floatAround(); //won't work, because 
this no longer points
to the Animation object, but this is what I want to do.
}
};
};

//user may click on the containing div to stop the animation.
$('#content').toggle(
function(){
startStop = 0;
},
function(){
startStop = 1;
//floater.floatAround(); //...and maybe start it again.
}
);

//start the animation
var floater = new Animation('#animate_me');
floater.floatAround();
});

thanks for any help in advance!


[jQuery] Re: Help tracking down error in IE8 / jquery 1.3.2

2009-06-07 Thread agnawt

Thanks - that worked perfectly for me.

On May 7, 10:40 am, Knut Hamang  wrote:
> Thanks. I have exactly the same issue. If using jquery-mini, here is
> the code to insert:
>
> // search for this
> return N.toUpperCase()});if(L){
> // insert this
> if(K=='NaNpx'){K=''}
> //before this
> J[G]=K}return J[G]}
>
> result:
> return N.toUpperCase()});if(L){if(K=='NaNpx'){K=''}J[G]=K}return J[G]}
>


[jQuery] Re: $.ajax({..}) throws syntax error in IE7

2009-06-07 Thread waseem sabjee
yeah. it really is best to keep function simple. ensure they work in their
simplest form before making them complex.

On Sun, Jun 7, 2009 at 10:38 PM, MorningZ  wrote:

>
> And to diagnose what Ricardo suggests (btoa issue), ** start simpler
> **
>
> as an example, does:
>
> var url = app_config.base_url + "/client/ajax/get_book_details_html/"
> + btoa(title);
> $.get(url, function(data){
>  alert("Get Loaded: " + data);
> });
>
> work?
>
> this will help determine if IE is having trouble evaluating your
> dynamically built URL endpoint
>
>
> On Jun 7, 4:29 pm, Ricardo  wrote:
> > IE's debugger points to the wrong lines often, maybe there's something
> > wrong before that call, or it could be your btoa() function.
> >
> > On Jun 7, 5:05 am, Gaz  wrote:
> >
> > > Hi all,
> >
> > > This is my first post to the group, so please be gentle :)
> >
> > > For some unknown (to me at least) reason I'm getting a syntax error in
>
> > > IE from the following code
> >
> > >  $.ajax({
> > >  type: "POST",
> > >  url: app_config.base_url + "/client/ajax/
> > > get_book_details_html/" + btoa(title),
> > >  processData: false,
> > >  data: order,
> > >  async: false,
> > >  success: function(html) {
> > >  $('#related_books').append(html);
> > >  $('#add_book_title').val('');
> > >  hide_loader();
> > >  }
> > >  });
> >
> > > The error is on the first line $.ajax({
> >
> > > This code works perfectly well in all the other browsers I've tested
> > > it on (FF Mac, FF Windows, Safari Mac).
> >
> > > Anybody got any ideas as to what the problem is?
> >
> > > Cheers,
> > > Gaz.
>


[jQuery] Re: Restrcit user copy the site page article

2009-06-07 Thread Ricardo

Intranet or not, the user will still have access to the source.

See here: http://www.lmgtfy.com/?q=disable+text+selection+javascript

On Jun 6, 9:51 pm, bharani kumar 
wrote:
> Hi its ok ya ,
> Am not bother abut the browser disable ,
>
> Because its intra net project ,
>
> So we disable in the systems,
>
> Tell me the snippet for that ,
>
> thanks
>
>
>
> On Sun, Jun 7, 2009 at 9:46 AM, Ricardo  wrote:
>
> > It's "doable", but save your efforts. After you deliver the HTML to
> > the user's browser, nothing is gonna stop him from copying it if he
> > wants to.
>
> > Ex: if you block it via Javascript, just disabling javascript nulls
> > it. In Firefox you can use -moz-user-select: none, but disabling CSS
> > or simply pressing Ctrl+U makes it useless.
>
> > On Jun 6, 8:48 pm, bharani kumar 
> > wrote:
> > > Hi All ,
>
> > > How to restrict the user copy the article content in the page ,
>
> > > 1.I want to disable the copy from the right click menu ,
>
> > > 2.also want to restrict the user Select all the article and take the copy
> > ,
>
> > > Any idea for this
>
> > > Thanks
>
> --
> Regards
> B.S.Bharanikumarhttp://php-mysql-jquery.blogspot.com/


[jQuery] Re: # of Pixels from the side of an element that the Mouse Cursor is located

2009-06-07 Thread Ricardo

On Jun 6, 6:36 pm, Evan  wrote:
> Hi there!
>
> I'm trying to:
>
> 1). Get the number of pixels from the left side of the hovered-element
> that the mouse cursor is located, and
> 2). Set *part* of a CSS attribute to this value
>
> I've been searching, but I can't find the answer to either of these.
> Does anyone know if they are possible? I apologize in advance if this
> is very basic, and I'm being stupid. I would really, really appreciate
> any guidance anyone could give.
>
> Thank you in advance for your help!

Get the mouse cursor position from the event object (http://
docs.jquery.com/Events/jQuery.Event#event.pageX.2FY) and the element
position with offset() (http://docs.jquery.com/CSS/offset):

$('#example').mouseover(function(e){
   var distance = e.pageX - $(this).offset().left;
   $(this).text( distance );
});

Are you having trouble to set the css value also? Would be something
along these lines:

$(this).css({
   fontSize: (distance/10)+'px';
});

--
ricardo


[jQuery] Re: $.ajax({..}) throws syntax error in IE7

2009-06-07 Thread MorningZ

And to diagnose what Ricardo suggests (btoa issue), ** start simpler
**

as an example, does:

var url = app_config.base_url + "/client/ajax/get_book_details_html/"
+ btoa(title);
$.get(url, function(data){
  alert("Get Loaded: " + data);
});

work?

this will help determine if IE is having trouble evaluating your
dynamically built URL endpoint


On Jun 7, 4:29 pm, Ricardo  wrote:
> IE's debugger points to the wrong lines often, maybe there's something
> wrong before that call, or it could be your btoa() function.
>
> On Jun 7, 5:05 am, Gaz  wrote:
>
> > Hi all,
>
> > This is my first post to the group, so please be gentle :)
>
> > For some unknown (to me at least) reason I'm getting a syntax error in  
> > IE from the following code
>
> >      $.ajax({
> >          type: "POST",
> >          url: app_config.base_url + "/client/ajax/
> > get_book_details_html/" + btoa(title),
> >          processData: false,
> >          data: order,
> >          async: false,
> >          success: function(html) {
> >              $('#related_books').append(html);
> >              $('#add_book_title').val('');
> >              hide_loader();
> >          }
> >      });
>
> > The error is on the first line $.ajax({
>
> > This code works perfectly well in all the other browsers I've tested  
> > it on (FF Mac, FF Windows, Safari Mac).
>
> > Anybody got any ideas as to what the problem is?
>
> > Cheers,
> > Gaz.


[jQuery] Re: $.ajax({..}) throws syntax error in IE7

2009-06-07 Thread Ricardo

IE's debugger points to the wrong lines often, maybe there's something
wrong before that call, or it could be your btoa() function.

On Jun 7, 5:05 am, Gaz  wrote:
> Hi all,
>
> This is my first post to the group, so please be gentle :)
>
> For some unknown (to me at least) reason I'm getting a syntax error in  
> IE from the following code
>
>      $.ajax({
>          type: "POST",
>          url: app_config.base_url + "/client/ajax/
> get_book_details_html/" + btoa(title),
>          processData: false,
>          data: order,
>          async: false,
>          success: function(html) {
>              $('#related_books').append(html);
>              $('#add_book_title').val('');
>              hide_loader();
>          }
>      });
>
> The error is on the first line $.ajax({
>
> This code works perfectly well in all the other browsers I've tested  
> it on (FF Mac, FF Windows, Safari Mac).
>
> Anybody got any ideas as to what the problem is?
>
> Cheers,
> Gaz.


[jQuery] Re: $.ajax({..}) throws syntax error in IE7

2009-06-07 Thread Gary Pearman

Yes, the line before is terminated with a semi-colon :)

As I said, the code works fine in all the other browsers I've tested
it in. It's just IE that throws an error.

Cheers,
Gaz.


On Jun 7, 4:26 pm, waseem sabjee  wrote:
> I tested the $.ajax working fine on my end.
>
> do you may be have a line before $.ajax({ ... that is not terminated with
> the  ;
>
>
>
> On Sun, Jun 7, 2009 at 2:05 PM, Gaz  wrote:
>
> > Hi all,
>
> > This is my first post to the group, so please be gentle :)
>
> > For some unknown (to me at least) reason I'm getting a syntax error in
> > IE from the following code
>
> >     $.ajax({
> >         type: "POST",
> >         url: app_config.base_url + "/client/ajax/
> > get_book_details_html/" + btoa(title),
> >         processData: false,
> >         data: order,
> >         async: false,
> >         success: function(html) {
> >             $('#related_books').append(html);
> >             $('#add_book_title').val('');
> >             hide_loader();
> >         }
> >     });
>
> > The error is on the first line $.ajax({
>
> > This code works perfectly well in all the other browsers I've tested
> > it on (FF Mac, FF Windows, Safari Mac).
>
> > Anybody got any ideas as to what the problem is?
>
> > Cheers,
> > Gaz.


[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-07 Thread Dean

OK, now I got it to work... I needed to re-establish the range inside
my ajax call. Cool. One wierd thing I did notice though is that
sometimes the insertion cursor disappears. Its in the right place, its
just not visible until you start to type. Thanks again for the
suggestions.


[jQuery] Re: grid layout plugin?

2009-06-07 Thread Jack Killpatrick


it's not a plugin, but maybe this: http://960.gs/

- Jack

bobh wrote:

Hi,

I've been on the lookout for a jquery plugin that fits divs together
into a nicely fitting layout. For example:

http://spacecollective.org/gallery/

more:
http://www.corneer.se/nolegacy/?p=528

Does it exist?

  





[jQuery] Re: code not work when upgraded from 1.2.3 to 1.3.2

2009-06-07 Thread Karl Swedberg

just remove the "@" symbol in the selector.

more info:
http://docs.jquery.com/Release:jQuery_1.3#Changes
http://blog.jquery.com/2007/08/24/jquery-114-faster-more-tests-ready-for-12/



--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jun 7, 2009, at 1:20 PM, angelochen...@gmail.com wrote:



Hi,

This code has been working in jQuery 1.2.3:

var country = jQuery("sele...@name='country']").get(0).value;

now in jQuery 1.3.2, I got this error:

[Exception... "'Syntax error, unrecognized expression:
[...@name='country']' when calling method:
[nsIDOMEventListener::handleEvent]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: ""  data: no]

Line 0

Any idea what adjustment needed?

Thanks,





[jQuery] Re: Slide show transition using backgrounds and pngs (jquery cycle lite)

2009-06-07 Thread D A

Ah, so this is definitely an IE issue rather than anything jQuery
centric. That makes sense!

-Darrel

> IE cant handle css-images properly
> Try to use your images as html.
>
> 2009/6/6 D A 
>
>>
>> > I'm attempting to create a mini slide show of rotating image. I'm
>> > using jquery cycle lite:
>> >
>> > http://malsup.com/jquery/cycle/lite/
>>
>> Well, after a lot more trial and error and experimenting, I've come to
>> the conclusion that the plugin (or, perhaps more likely, IE) can't
>> handle background images as part of the fade (they 'pop out' upon each
>> fade in of the container) nor transparent PNGs (during the fade
>> in/out, it reverts to 1-bit transparency).
>>
>> So, for now, the fix will be careful image creation matching the
>> background and using them as inline images.
>>
>> Not ideal, but meets our needs.
>>
>> If anyone has used an image rotator that can allow IE to:
>>
>>   - do a fade transition
>>   - handle background images
>>   - (and bonus: handle the fading of transparent PNGs)
>>
>> please let me know!
>>
>> -DA
>>
>
>
>
> --
> Gustavo Salome Silva
>


[jQuery] code not work when upgraded from 1.2.3 to 1.3.2

2009-06-07 Thread angelochen...@gmail.com

Hi,

This code has been working in jQuery 1.2.3:

 var country = jQuery("sele...@name='country']").get(0).value;

now in jQuery 1.3.2, I got this error:

[Exception... "'Syntax error, unrecognized expression:
[...@name='country']' when calling method:
[nsIDOMEventListener::handleEvent]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: ""  data: no]

Line 0

Any idea what adjustment needed?

Thanks,



[jQuery] Re: grid layout plugin?

2009-06-07 Thread bh

for what it's worth, I found one: http://desandro.com/resources/jquery-masonry

On 15 apr, 17:16, bobh  wrote:
> Hi,
>
> I've been on the lookout for a jquerypluginthat fits divs together
> into a nicely fittinglayout. For example:
>
> http://spacecollective.org/gallery/
>
> more:http://www.corneer.se/nolegacy/?p=528
>
> Does it exist?


[jQuery] Re: who cann't i make it work?my first jquery aspx page

2009-06-07 Thread mkmanning

"should be in the head area of the document."
No it shouldn't. You can put it in the head if you like, but
Javascript blocks downloads, it's ideally a behavior layer that
enhances presentation, etc. Much has been written about putting js at
the close of the body as a best practice:
http://developer.yahoo.com/performance/rules.html#js_bottom

Whether at the top or bottom, your script will fail if you don't
include it in the correct order. room.js requires jQuery, but is being
requested before the jQuery library.

On Jun 7, 7:08 am, jerome  wrote:
>   
>      script>
> should be in the head area of the document.
>
> - Original Message -
> From: "dotnet" 
> To: "jQuery (English)" 
> Sent: Saturday, June 06, 2009 1:19 PM
> Subject: [jQuery] who cann't i make it work?my first jquery aspx page
>
> > <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Chat.aspx.cs"
> > Inherits="Chat" %>
> > <%@ Import Namespace="OLChatRoom" %>
>
> >  >www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > http://www.w3.org/1999/xhtml";>
> > 
> >    . . . .
> >     > rel="stylesheet" />
> >  my .aspx page:
> > 
> > 
> >    
> >         > runat="server"/> > >         > EnablePartialRendering="True" EnablePageMethods="True"> > > >         > >
  • the person u r chatting to is from > > > asp:Label>
> >

> >
> >