[jQuery] Re: routing event to html map

2009-05-16 Thread jayarjo


Thanks. I've figured it out.The problem is, that the image getting
manually triggered click event doesn't route it further to the
associated html map (but it should, right? logically thinking). So my
solution was to catch the event on image and route it further
manually.

On May 16, 9:51 pm, infoaddicted  wrote:
> It would be helpful if you posted snippets of your HTML along with the
> JQuery code.
>
> On May 16, 12:26 pm, jayarjo  wrote:
>
> > I've got several map tags with custom areas defined and corresponding
> > images with usemap attributes. The problem is that those images are
> > covered with transparent div. I manually intercept events on that div
> > and route them to the images underneath it. But maps do not seem to
> > react to routed events anymore. Is it correctable somehow? Or maybe
> > I'm doing something wrong? The structure cannot be altered,
> > transparent div must be on top and images and their corresponding maps
> > must get the click event somehow :(
>
> > Any suggestions?


[jQuery] Re: bubbling of triggered events... ?

2009-05-16 Thread jayarjo


I was trying to catch an event on body tag, for example this doesn't
work as expected:












$('#one').trigger('click');



although this one works:














$('#one').trigger('click');



it took me sometime to figure this out, ' cause it was not stated
anywhere. Why - body tag is not considered as parent?



On May 17, 2:49 am, Mike Nichols  wrote:
> can you show some code that isn't working
>
> On May 16, 6:21 am, jayarjo  wrote:
>
> > "New in jQuery 1.3:
>
> > All triggered events now bubble up the DOM tree. For example if you
> > trigger an event on a paragraph then it will trigger on that element
> > first, then on the parent element, and its parent, and so on up to the
> > document. The event object will have a .target property equal to the
> > original triggered element. You can prevent the bubbling by calling
> > stopPropagation() or by returning false from your 
> > callback."http://docs.jquery.com/Events/trigger#eventdata
>
> > In other words triggered event should bubble up to it's parent
> > container, should it? If yes, then I want to catch it on parents level
> > and trigger it on another child of choice, and so on. But it doesn't
> > seem to bubble... :(
>
> > Any help appreciated.


[jQuery] Re: Slide to fade, can you help me quick? Noob alert!

2009-05-16 Thread mkmanning

Btw, you could also combine both effects:

jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', height: 'toggle'}, speed,
easing, callback);
};

On May 16, 9:49 pm, mkmanning  wrote:
> You can make your own:
>
> jQuery.fn.fadeToggle = function(speed, easing, callback) {
>    return this.animate({opacity: 'toggle'}, speed, easing, callback);
>
> };
>
> Probably a little beyond you right now, but study it and check out the
> docs.
>
> HTH :)
>
> On May 16, 9:50 am, Sobering  wrote:
>
> > Hey guys,
>
> > I'm building a site for the company I work at. I'm a pretty
> > experienced web designer and coder (as far as standards compliant html/
> > css goes), but I'm a complete noob to javascript & jQuery, but I'm
> > trying.
>
> > I found this snippet of code online:
>
> > $(document).ready(function(){
> >         $(".loginToggle").click(function(){
> >                 $("#loginForm").slideToggle("slow");
> >         });
>
> > });
>
> > Right now, as you can probably tell, when you click the link with the
> > class .loginToggle it slides open the div with the ID #loginForm form
> > which is set to display: none; by default. What I want it to do
> > instead of sliding is fading in and out when the link is clicked.
>
> > In the current code it says "slideToggle," so being the noob I am, I
> > tried changing it to "fadeToggle" with no success. I'm pretty positive
> > that this should be an easy solution.
>
> > I'd highly appreciate any help you guys can give!
>
> > Cheers, Sobering


[jQuery] Re: Slide to fade, can you help me quick? Noob alert!

2009-05-16 Thread mkmanning

You can make your own:

jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

Probably a little beyond you right now, but study it and check out the
docs.

HTH :)

On May 16, 9:50 am, Sobering  wrote:
> Hey guys,
>
> I'm building a site for the company I work at. I'm a pretty
> experienced web designer and coder (as far as standards compliant html/
> css goes), but I'm a complete noob to javascript & jQuery, but I'm
> trying.
>
> I found this snippet of code online:
>
> $(document).ready(function(){
>         $(".loginToggle").click(function(){
>                 $("#loginForm").slideToggle("slow");
>         });
>
> });
>
> Right now, as you can probably tell, when you click the link with the
> class .loginToggle it slides open the div with the ID #loginForm form
> which is set to display: none; by default. What I want it to do
> instead of sliding is fading in and out when the link is clicked.
>
> In the current code it says "slideToggle," so being the noob I am, I
> tried changing it to "fadeToggle" with no success. I'm pretty positive
> that this should be an easy solution.
>
> I'd highly appreciate any help you guys can give!
>
> Cheers, Sobering


[jQuery] Re: Issue with setting click event functions in a for loop

2009-05-16 Thread mkmanning

You might want to doublecheck that when you click the elements you
took out of the loop, you really get what you say. Given your example,
if you click #page2 it should alert 'page3' also.

You don't really need the loop to attach the click and get at the
number if it's part of the id:

$('div[id^=page]').click(function(){
  console.log('page ' + this.id.replace(/page/,'') + ' clicked.');
});

Try Googling global variables, scope, and closures in JavaScript.


On May 16, 2:16 pm, mikfig  wrote:
> I have a webpage that searches a database using a php script to search
> the database and a jQuery app on the page to retrieve the results and
> show them. So it works fine, but then I want to add page number
> buttons to allow the user to go to different "pages" of the results.
> So I have a DIV with the id of "page_buttons" and I use the following
> code:http://pastebin.com/m3dffbf99
>
> I use the offset and the results per page like this in a MySQL query
> in the php script: SELECT  LIMIT offset,
> resultsPerPage by the way.
>
> So anyways, the problem I am having is that if I have a loop like
> this:
>
> var pageNum = 6;
> ...
> for(var i = 0; i <= pageNum; ++i)
> {
>     $("#page" + i).click(function() { alert('page ' + i + '
> clicked.'); });
>
> }
>
> The elements with IDs of "page1", "page2",... are buttons, and I
> tested the above loop. What happens is if I click any of the buttons
> with IDs of "page1", "page2",.. then they all "alert" with the string
> "page 7 clicked". All the page buttons 1-6 display the string "page 7
> clicked".
>
> To try to greater understand this problem I took the functionality out
> of the loop like this:
>
> var i = 2;
> $("#page" + i).click(function() { alert('page ' + i + '
> clicked.'); });
> i = 3;
> $("#page" + i).click(function() { alert('page ' + i + '
> clicked.'); });
>
> and it worked just fine with "page2" alerting "page 2 clicked and
> "page3" alerting with "page 3 clicked".
>
> So I was hoping someone could help me in explaining why this issue
> occurs and if there was a better way to do what I'm trying to do.
>
> Thanks,
> mikfig


[jQuery] problem on fadeIn with flash

2009-05-16 Thread Kenneth Ma

I've tried to use fade in for a div that contain a flash. But there is
a split second right before it fadein, it has a sparkling white piece
at there. (see kenportfolio.com) Does anyone know how to fix that
issue, or even fixable?

Remind you to use Konami code to see the fadeIn effect.

Code:

$('#swfobject').fadeIn('slow');


  

[jQuery] Issue with setting click event functions in a for loop

2009-05-16 Thread mikfig

I have a webpage that searches a database using a php script to search
the database and a jQuery app on the page to retrieve the results and
show them. So it works fine, but then I want to add page number
buttons to allow the user to go to different "pages" of the results.
So I have a DIV with the id of "page_buttons" and I use the following
code: http://pastebin.com/m3dffbf99

I use the offset and the results per page like this in a MySQL query
in the php script: SELECT  LIMIT offset,
resultsPerPage by the way.

So anyways, the problem I am having is that if I have a loop like
this:

var pageNum = 6;
...
for(var i = 0; i <= pageNum; ++i)
{
$("#page" + i).click(function() { alert('page ' + i + '
clicked.'); });
}

The elements with IDs of "page1", "page2",... are buttons, and I
tested the above loop. What happens is if I click any of the buttons
with IDs of "page1", "page2",.. then they all "alert" with the string
"page 7 clicked". All the page buttons 1-6 display the string "page 7
clicked".

To try to greater understand this problem I took the functionality out
of the loop like this:

var i = 2;
$("#page" + i).click(function() { alert('page ' + i + '
clicked.'); });
i = 3;
$("#page" + i).click(function() { alert('page ' + i + '
clicked.'); });

and it worked just fine with "page2" alerting "page 2 clicked and
"page3" alerting with "page 3 clicked".

So I was hoping someone could help me in explaining why this issue
occurs and if there was a better way to do what I'm trying to do.

Thanks,
mikfig


[jQuery] Replacing button with but can't copy the onclick stuff

2009-05-16 Thread Qphoria

OK... I have a few input buttons per page:



I want to convert them to:
http://www.mysite.com/xxx.html";>MyButton

How can I convert that with jquery? I try to get the onlick val but
jquery or javascript seems to convert onclick to a function.

I have this, but it's not quite right, I'm trying to just move the
onclick data to the link, but I'd rather do it with href.

$(":button").each(function(){
var ocval = $(this).attr("onclick").val();
$(this).replaceWith("" + $(this).val() + "");
});



[jQuery] Repeating userCollapseText

2009-05-16 Thread jorgevima74

Hi!
I'm using jquery.expander and I'm getting twice the userCollapseText
value ( [collapse all][collapse all]). You know why???

Jorge.


[jQuery] Re: tutorial

2009-05-16 Thread Shawn


Any time you see something like

$("a").addClass("test");

You can assume this is JavaScript.  In particular, this is JS that makes 
use of the jQuery library.  JavaScript can only appear in certain places 
- either in an included .js library (via src="someLibrary.js">), or within  tags.

Where jQuery is concerned, the $() method is not available until after the jQuery library has been included. So make sure you include the library BEFORE doing anything that makes use of jQuery.

In addition though, you often don't want the jQuery code executed until the page is done loading. In this case, if the addClass method is called before the HTML is rendered, then nothing will happen because the $("a") would return nothing. In this case you want to make sure your command is put inside the .ready() method. For example: