( WP Plugins)
<!--more--> links into "view right here" links. When clicked, the rest of that entry's content will be loaded and made visible to the reader immediately, without redirecting them to the post's single page display.
To view this plugin in action, visit the Wooliet front page and find an entry with a "read more" link. Click the link and watch the content load. Click again and the content will slide back out of view.
<!--more--> quicktag) are modified to no longer send the user to that post's single page display when clicked. Instead, the Wordpress database is queried for that specific post, and all content after the <!--more--> tag (i.e. only what you need) is returned. The new content is then immediately displayed to the user, inline with the opening content.
If clicked once more, the new content will slide out of view. Now that it has loaded, any subsequent clicks will simply re-display that existing content. No new server requests are made!
If, for some reason, the request fails, an error message is displayed where the new content would have been seen. The <!--more--> link then reverts to normal use so that the reader can still click on it to go to its single page display.
loader directory located in the plugin's root directory. Then visit the Settings page and set that image using the Loader Image option.
3. Debugging the Javascript
The javascript used for this plugin is found in "read-more-right-here/js/wt_rmrh.js". It has been compressed using Google's Closure Compiler. The original, uncompressed javascript is also included and is named "wt_rmrh-debug.js". To use the uncompressed javascript file, visit the plugin's Settings page and check the Use Debug Script option.
4. Calling the Plugin Manually
If the plugin needs to be executed manually for any reason (see this support thread for an example), it can be called directly:
// No arguments: executes plugin on entire document (but already modified 'more links' will be ignored)
$.fn.ReadMoreRightHere();
// Within a more specific context: executes plugin within provided context
$.fn.ReadMoreRightHere('div.dynamic-content');
5. Client-side events
The plugin client-side code triggers custom "events" using jQuery's trigger method. Other scripts loaded to the page can hook into these events to offer additional functionality.
'RMRHContentExpanded' is triggered when the new content is displayed'RMRHContentCollapsed' is triggered when the new content is hidden
// '.post' is the post containing element.
jQuery('.post').bind('RMRHContentExpanded RMRHContentCollapsed',function(e,data)
{
console.log(e.type);
console.log(data.itemId);
console.log(data.moreContentEl);
console.log(data.linkEl);
// return false; // prevents event from bubbling up the DOM
});