p:ajaxStatus at mouse pointer position

UI Components for JSF
Post Reply
User avatar
Mucuraga
Posts: 12
Joined: 08 Jun 2012, 21:08
Location: Turkey

30 Mar 2013, 19:20

I would like to show ajax spinner animated gif near mouse position at the moment of mouse click.
How can achieve this?

Regards

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

30 Mar 2013, 19:38

Why not do:

Code: Select all

.myAjaxWaitClass {
    cursor:wait;
}
http://www.w3schools.com/cssref/playit. ... reval=wait
or

Code: Select all

.myAjaxProgressClass {
    cursor:progress;
}
http://www.w3schools.com/cssref/playit. ... l=progress

or even

Code: Select all

.myAjaxCustomCursor {
    cursor: url(myImage.gif);
}
http://www.w3schools.com/cssref/playit. ... ur%29,auto
Last edited by kukeltje on 30 Mar 2013, 19:49, edited 2 times in total.

User avatar
Mucuraga
Posts: 12
Joined: 08 Jun 2012, 21:08
Location: Turkey

30 Mar 2013, 19:41

kukeltje wrote:Why not do:

Code: Select all

.myAjaxWaitClass {
    cursor:wait;
}
Not because showing artistic spinner is better :)

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

30 Mar 2013, 19:49

I edited my post... with some more examples... please have a look again

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

30 Mar 2013, 19:51

Personally I think that showing a the 'progress' cursor is better than showing 'artistic spinner' is 'better'.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 Mar 2013, 23:59

Hi Ronald,

I've upgraded your account to PrimeFaces Elite.

Please login at;

http://www.primefaces.org/elite/

You should be able to see all the elite stuff available.

Have a nice weekend!

Btw your intercommit email doesn't seem to be working for me.

Optimus

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

31 Mar 2013, 12:20

Thanks, really appreciate it. I might sometimes have critisism, but really like what is being done. Will send a more detailed response via a new email address (due to a takeover, the former address indeed does not work anymore)

jepsar
Posts: 166
Joined: 03 Sep 2014, 11:41
Location: NL / BE
Contact:

23 Jun 2022, 13:18

Indeed, progress is better IMO

Code: Select all

<p:ajaxStatus ...
              onstart="$('html').addClass('progress')"
              oncomplete="$('html').removeClass('progress')">
    ...
</p:ajaxStatus>

Code: Select all

html.progress, html.progress * {
    cursor: progress !important;
}
See also https://stackoverflow.com/questions/157 ... n-progress
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub: https://github.com/jepsar
Spotify: 90s Rave, Acid, Trance, House

landavid009
Posts: 1
Joined: 02 Aug 2022, 12:00

02 Aug 2022, 12:08

kukeltje wrote:
30 Mar 2013, 19:38
Why not do:

Code: Select all

.myAjaxWaitClass {
    cursor:wait;
}
http://www.w3schools.com/cssref/playit. ... reval=wait
or

Code: Select all

.myAjaxProgressClass {
    cursor:progress;
}
http://www.w3schools.com/cssref/playit. ... l=progress

or even

Code: Select all

.myAjaxCustomCursor {
    cursor: url(myImage.gif);
}
http://www.w3schools.com/cssref/playit. ... ur%29,auto


You can achieve this with a little help of CSS and jQuery. With CSS, you can create a class which changes the cursor on the entire document. With jQuery, you can add/remove that CSS class. Under the covers, PrimeFaces uses jQuery for the ajax magic and you can for PrimeFaces <4 hook on standard jQuery ajaxStart and ajaxStop events and for PrimeFaces 4+ hook on PrimeFaces specific pfAjaxSend and pfAjaxComplete events to perform the add/remove of that CSS class.

CSS:

html.progress, html.progress * {
cursor: progress !important;
}
(the !important overrides any style set by style attribute and stronger CSS selectors for the case that)

jQuery and PrimeFaces:

$(document).on("ajaxStart pfAjaxSend", function() {
$("html").addClass("progress");
}).on("ajaxStop pfAjaxComplete", function() {
$("html").removeClass("progress");
});
For the case you're also using standard JSF <f:ajax> elsewhere and would like to have the same progress indicator, here's how you can do that:

jsf.ajax.addOnEvent(function(data) {
$("html").toggleClass("progress", data.status == "begin");
});






autoclicker for minecraft

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 52 guests