Hi,
It doesn't function in my configuration.
I agree with your sentence
Might work if your ellipses are right.
The
event is not defined on the ...:target object while
-
$(window).hashchange
( function () { $("...:target).each( action) })
Can give an action if hashchange function is defined or
- $(window).on
("hashchange", function (){})
if not and if the same event hole is not fired twice (I return on
this at the end).
What are my progresses on the way
I uses jq 1.11.1 but not JQ mobile.
The navigator is the last version of Chrome.
The development is done on desktop (win7 pro) but must be portable
to mobiles.
For now I test currently with Android Kitkat with chrome.
The context is WordPress for which I develop several plugins (and
also TikiWiki).
With the debugger the hashchange is not kept (no target defined)
- I
have tested $(window).on("hashchange")
- Not
yet tested $(document).on("hashchange" , function () {.......})
A $(...).hashchange( ... ); locks on invalid and undefined function
(the same with the event as parameter seams (behaves like invalid : so
ignored) to ignore it.
The function .hashchange for JQ mobile with the exact purpose that
I follow as comments.
I tried to installed it but the chrome navigator for windows seems
unable to hold it or more probably JQ mobile tests the device
application context.
I could not find a simple memo detailed list of events for each
object type.
The search of keyword "hashchange" doesn't give any
result on the JQ API site while JQ plugins gives 3 answers :
They are all two years old.
The third gives a description of what I am implementing on
WordPress (Desk and mobile)
The second "jquery-hashchange-master" provides a
"jquery-hashchange.js" which as the effect that there is no
more error on .hashchange function but $(window).hashchange remains
without any action
The first : "hail2u-jquery.xhashchange-v0.2.2-0-g4bc6db7"
provides a "jquery.xhashchange.js" which functions for now
normally (it is a hashchange function defined for JQ which is added to
JQ current loaded version).
Then I had to, for any case, change some parts of code (the ID
values of elements targeted) to be able to hold a quick (hierarchical
selective) targeting way on elements linked to the hash so that I can
run the function on the right element within a minimum of test.
I have not ended the test and basic implementation because I was
away yesterday.
For now it remains two problems (the visible ones : may be more):
- The future portability of the code (not have twice the
definition of the function). It is the reason why I have tested
the JQ Mobile installation to get the function (which must be
activated on desktop version also)
- The way for jquery.xhashchange to send back -bind - the event to
the system while it can be a hole if not). I observed in first
test that the actions generated by the event (scroll to the
#fragment and run the css #fragment:target ... {... } which seem
to be performed before the hashchange function. This can change
the way to hold the vent (for example the data about the position
of #fragment into the viewport)
- Why the (window).on("hashchange ...") doesn't
function, I am going to check the whole code deeper (it is all
Wordpress with 100 plugins...) because for example if there are
twice (or equivalent) $(window).hashchange(...) the second will
never get the event.
I go back with news on tests
Best regards
Trebly