Posted by kvvnn on July 26, 2009 at 10:26pm
Jump to:
| Project: | Popups API (Ajax Dialogs) |
| Version: | 6.x-2.0-alpha5 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Oy!
Is there a way to set the horizontal scrollbar position in the Popup window to the very top?
At the moment the vertical scrollbar defaults at the center.
I was thinking even something like : $popup.focus( $('popupTitle') );
Any guidance?
Comments
#1
UPDATE:
It seems that only when I open nodes with comments within a popup window does the vertical scrollbar default in the middle. Otherwise, the scrollbar is positioned at the top.
#2
Changing this bit of code in popups.js fixed my problem.
/**
* Set the focus on the popups to the first visible, enabled form element, or the close link.
*/
Popups.Popup.prototype.refocus = function() {
// Select the first visible enabled input element.
var $popup = this.$popup();
// kvn ( Tim ) // var $focus = $popup.find(':input:visible:enabled:first');
// kvn ( Tim ) // if (!$focus.length) {
// There is no visible enabled input element, so select the close link.
$focus = $popup.find('.popups-close a'); // kvn ( Tim )
//}
$focus.focus();
};
#3
I had the same problem, but I am using version 1.3. I replaced the whole "Drupal.popups.refocus" function with the code in #2 code and it worked. What's interesting is that there is even a comment in the original code, "doesn't seem to work."
From:
<?php/**
* Set the focus on the popups to the first visible form element, or the first button, or the close link.
*/
Drupal.popups.refocus = function() {
$focus = $('#popups input:visible:eq(0)');
if (!isset(focus)) {
$focus = $('#popups-close'); // Doesn't seem to work.
}
$focus.focus();
};
?>
To:
<?php/**
* Set the focus on the popups to the first visible form element, or the first button, or the close link.
*/
Drupal.popups.refocus = function() {
// Select the first visible enabled input element.
var $popup = this.$popup();
// kvn ( Tim ) // var $focus = $popup.find(':input:visible:enabled:first');
// kvn ( Tim ) // if (!$focus.length) {
// There is no visible enabled input element, so select the close link.
$focus = $popup.find('.popups-close a'); // kvn ( Tim )
//}
$focus.focus();
};
?>