mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Handling in-page anchor links gracefully and correctly.
This commit is contained in:
parent
3bd9ecab3b
commit
c91188dc1b
1 changed files with 16 additions and 1 deletions
|
@ -811,6 +811,7 @@
|
|||
var $story_iframe = this.$story_iframe;
|
||||
var $taskbar_view_page = $('.NB-taskbar .task_view_page');
|
||||
var $taskbar_return = $('.NB-taskbar .task_return');
|
||||
this.flags.iframe_view_loaded = false;
|
||||
|
||||
if (!feed_id) {
|
||||
feed_id = $story_iframe.data('feed_id');
|
||||
|
@ -871,7 +872,21 @@
|
|||
try {
|
||||
$story_iframe.contents().find('a')
|
||||
.unbind('click.NB-taskbar')
|
||||
.bind('click.NB-taskbar', function() {
|
||||
.bind('click.NB-taskbar', function(e) {
|
||||
var href = $(this).attr('href');
|
||||
if (href.indexOf('#') == 0) {
|
||||
e.preventDefault();
|
||||
var $footnote = $('a[name='+href.substr(1)+'], [id='+href.substr(1)+']',
|
||||
$story_iframe.contents());
|
||||
// NEWSBLUR.log(['Footnote', $footnote, href, href.substr(1)]);
|
||||
$story_iframe.contents().scrollTo($footnote, 600, {
|
||||
axis: 'y',
|
||||
easing: 'easeInOutQuint',
|
||||
offset: 0,
|
||||
queue: false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
self.taskbar_show_return_to_page();
|
||||
});
|
||||
self.$story_iframe.contents()
|
||||
|
|
Loading…
Add table
Reference in a new issue