Jquery mobile - scroll to bottom automatically after page is loaded - spring

I'm building a peer-to-peer chat. Whenever I open the chat (means after server-roundtrip) the suiting jsp will be displayed decided by a spring-controller. The latest chat comment is at the bottom of the scrollable page.
Unfortunately when page is loaded there's no reaction to the jquery method like
$(document).scrollTop(1000);
to get to the bottom of the page.
I also put this method inside pageInit and pageBeforeShow events of jqm. But in vain.
What's wrong?

Related

PupeteerSharp - Feature For Browser Lock

I am trying to scrape hyperlinks that are initiated by JS. The problem is when I click on items such as tags, the browser navigates away in the "Request" event. Then all of the following elements error out when clicking because the page is no longer there. Is there a way to prevent the page from navigating away?
Thanks!

How will an RSVP form stay on the same section after submitting on a one page WordPress layout

I have a one page layout WordPress page and an RSVP form at the bottom and The RSVP form works just fine.
THE PROBLEM:
When I try to submit the name of the guest, the page loads and you will brought now at the topmost section of the page instead of the bottom part where you will continue to fill up the RSVP form. The RSVP form has two parts, first the name of the guest and second, the actual selection of the RSVP options. So after submitting, you will need to scroll down at the bottom of the page just to see if you entered your name correctly or if your RSVP has been completed.
This RSVP form is a plugin from WordPress: RSVP plugin
I just want to use this RSVP form to work on a one page layout.
SOME SOLUTIONS THAT I'M THINKING:
AJAX - I think using AJAX will do the trick but I really don't know how to put AJAX into the plugin and into my WordPress page. I tried installing AJAX plugins but I'm not sure how to work it out.
ANCHOR TAG - I think if there is an anchor tag at the end of the URL, the page will force the browser to stay at the bottom of the page where the RSVP section is located. But this anchor tag should be automatically be there when you scroll on every section of the one page layout. But how will I do that?
I also tried malsup's Jquery Form Plugin but I really don't know how to work on it. Whenever I submit the form, an alert pops out.

Facebook like button's iframe not expanded after ajax request

I'm adding a facebook share button to each post on a Wordpress (Using Facebook Share Button New plugin), it works ok for each post/page except when i'm loading them trough ajax, the result it's a normal Facebook like button but the popup (to write a comment) appears inside the button it is not expanded.
To check go to: http://iwanttobeher.com/ and then click on any face at the bottom of the page, then test the like button and you'll see what happens.
I don't know what to do, i tried to FB.XFBML.parse() after loading the content but the result is the same.
Switching to HTML5 didn't help in our case. What did was to remove the FB object just prior to new content being inserted into the page via Ajax:
delete FB;
wrapper.html(response.data);
We reload full pages via Ajax and so new page content recreates the FB object and re-initializes XFBML anyway. Not sure if this workaround would work if we reloaded only parts of the page though.
The original answer is here.
I've managed to fix it by changing the implementation to HTML5 instead Iframe or XFBML using Facebook's tool to generate like buttons: https://developers.facebook.com/docs/reference/plugins/like/

Facebook like page loading

I need to know how is it possible using AJAX to navigate between pages like Facebook. When I click a link in Facebook the url in address bar changes and the main content area is reloaded with new content but the navigation list on left, header on top and chat on left side remain intact. It appears that those sections are not reloaded. How this become possible when the address bar changes? please ,if possible give a small example.
You can use libraries such as history.js coupled with ajax calls. This library dynamically modifies the URL as you are clicking around the site. The library is available at https://github.com/browserstate/History.js. And a great demo is available at http://rypit.me/demos/isotory/tutorial/history.js.html

jQuery Mobile hash navigation doesn't work in multipage template when entering site from interior page

Overview
I've set up a site using jQuery Mobile. The problem I'm having is that when I enter the site from an interior page (like the blog pages) and click on the navigation buttons in the header, I can go back to the homepage but then none of the ajax/hash-based navigation links work. In my header navigation I've linked the left-side navigation buttons directly with hrefs, not using data-rel="back". I'm not trying to use the buttons to imitate the browser's back button, but rather for absolute navigation. I've tested this on the desktop in Chrome and Firefox and on an iPhone running iOS 5 in Mobile Safari; the behavior is the same in all browsers.
Edit: (Note specific questions below in bold italic.)
What works and what doesn't
For example, if you go to the interior page http://slawson.org/blog/ and then click the < Kim button in the header to go back to the homepage, then you can only go to absolute links (like Blog) but none of the hash-based links (the other links under the "Portfolio" and "About" headers) work... clicking on the links does not fire a page transition, instead the links just blink and do nothing.
If you enter the site from the homepage — http://slawson.org/ — or one of the subpages of the homepage — like http://slawson.org/#web — this problem does not occur.
index.html — contains most of the other pages that use hash-based navigation (these don't work), e.g.:
Web Sites
iOS Applications
Print Publications
Logos & Branding
...
blog/index.html and blog/.../*.html — regular pages loaded via JQM's ajax loader (these work).
Question
Is there a problem with JQM and ajax navigation when entering sites from interior pages, or is this something that can be fixed by restructuring things or adding some jQuery somewhere? I'd like to avoid breaking every page into a separate html file.
Versions
I'm using jQuery 1.8.2 and jQuery Mobile 1.2.0.
Edit:
I looked at the JQM multi-page template docs and at these related StackOverflow questions:
jQuery mobile page navigation behaviour
Facing an issue in jquerymobile's multi page template stucture
JQuery Mobile - link from external page (SinglePage-template) to an internal page (MultiPage-template)
Things I've tried:
data-url
I tried adding data-url to the multi-pages in index.html, like so:
<div data-role="page" id="web" data-url="index.html#web" data-title="Kim Slawson | Web Sites" class="shorter-list-items">
but that didn't help.
data-rel="external"
I tried adding data-rel="external" to links to the homepage, like this link on the navigation button on the blog page:
Kim
but that didn't help either.
data-ajax="false"
I tried adding data-ajax="false" to links to the homepage, like this link on the navigation button on the blog page:
Kim
This works (i.e., you can go to the homepage, then all of the multi-pages work) BUT the transition does not fire going to the homepage. Is there a way to add a transition to this link, perhaps by giving it a class and then using some jQuery to bind to that class to fire the transition? or is there a better way? (Of note, the back button works fine after I add data-ajax="false" to the link to the homepage. Clement Ho's answer here implies that adding it breaks the back button, but I'm not seeing that)
The problem is that the hash-based pages don't exist on the page when you're clicking the links to them. (<div data-rolw="page" id="#web">...</div> isn't there)
If you have a back-end framework set up, you could return the the hash-based pages, along with the requested page, whenever a non-ajax (the initial) request is made. Then those pages will be in the DOM no matter what page is loaded first.
The other alternative is, like you said, to break every page into its own file.

Resources