Offset() - setting values issue using 1.3
I'm trying to set the offset position of a div using the following:
- $("div#search-filters").offset({ top: 500, left: 500 });
For some reason, this isn't working - the other functions within the script are, so the script itself doesn't seem to be the issue. If I use the latest library release (1.4.2) this works fine, but I'm restricted to using 1.3 as it's managed by the Drupal framework.
I'd eventually like to set the offset values using something like the example below, but for now, I can't even get this simplified version working. Any suggestions for the above, and comments on what I'm attempting below would be very much appreciated.
- $("div#search-filters").show();
var nav = $("div#block-author_blocks-sidebar_navigation");
var filter = $("div#search-filters");
var navPosTop = nav.offset().top;
var navPosLeft = nav.offset().left;
var navBottom = (navPosTop + $("div#block-author_blocks-sidebar_navigation").height());
var filterPosTop = filter.offset().top;
if (filterPosTop < navBottom) {
var filterPosTopNew = navBottom;
var filterPosLeftNew = navPosLeft;
$("div#search-filters").offset({ top: filterPosTopNew, left: filterPosLeftNew });
$("div#search-filters").addClass('no-border');
}
Thanks,
John.