在不查看扩展器插件的细节的情况下,这是我最近在我自己的一个站点中使用的解决方案。希望您可以自定义以使用您正在使用的扩展器插件。我不能把变量解析归功于它,这起源于其他地方。
您的链接需要这样设置:
http://jjnursingnotes.com/NOV12?section=01
然后你的JavaScript:
<script type="text/javascript">
// Redirect to Appropriate Section
var urlParams = {};
(function () {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
while (match = search.exec(query))
urlParams[decode(match[1])] = decode(match[2]);
})();
$(document).ready( function(){
if ( urlParams['section'] != '' ) {
// urlParams['section'] variable = the ?section=XXX part of URL
// Here is where you would need integration with expanding box
// Assuming you use something like <div class="expander" id="sect01">
// as your expander, something to this effect ought to work:
$("#sect" + urlParams['section'] ).find(".read-more a").click();
// Position document at start of anchor
$('body,html').animate({ scrollTop: $("#sect" + urlParams['section'] ).offset().top }, 500 );
}
});
</script>