Side navigation
Ticket #1560: scroll.diff
File scroll.diff, 1.3 KB (added by saturnflyer, September 01, 2007 08:04PM UTC)
ScrollToAnchors behavior changes
Index: ifxscrollto.js
===================================================================
--- ifxscrollto.js (revision 3054)
+++ ifxscrollto.js (working copy)
@@ -46,14 +46,32 @@
return this.each(
function()
{
- jQuery('a[@href*="#"]', this).click(
+ jQuery('a[@href^="#"]', this).click(
function(e)
{
parts = this.href.split('#');
- jQuery('#' + parts[1]).ScrollTo(speed, axis, easing);
- return false;
+ if(jQuery('#' + parts[1]).size() > 0) {
+ jQuery('#' + parts[1]).ScrollTo(speed, axis, easing);
+ return false;
+ } else if(jQuery('a[@name='+parts[1]+']').size() > 0) {
+ jQuery('a[@name='+parts[1]+']').ScrollTo(speed, axis, easing)
+ return false;
+ }
}
);
+ jQuery(document).ready(
+ function() {
+ var loc = new String(document.location);
+ if (loc.search('#') != -1) {
+ var loc_parts = loc.split('#');
+ if(jQuery('#' + loc_parts[1]).size() > 0) {
+ jQuery('#' + loc_parts[1]).ScrollTo(speed, axis, easing);
+ } else if(jQuery('a[@name='+loc_parts[1]+']').size() > 0) {
+ jQuery('a[@name='+loc_parts[1]+']').ScrollTo(speed, axis, easing)
+ }
+ }
+ }
+ );
}
)
}
Download in other formats:
Original Format
File scroll.diff, 1.3 KB (added by saturnflyer, September 01, 2007 08:04PM UTC)
ScrollToAnchors behavior changes
Index: ifxscrollto.js
===================================================================
--- ifxscrollto.js (revision 3054)
+++ ifxscrollto.js (working copy)
@@ -46,14 +46,32 @@
return this.each(
function()
{
- jQuery('a[@href*="#"]', this).click(
+ jQuery('a[@href^="#"]', this).click(
function(e)
{
parts = this.href.split('#');
- jQuery('#' + parts[1]).ScrollTo(speed, axis, easing);
- return false;
+ if(jQuery('#' + parts[1]).size() > 0) {
+ jQuery('#' + parts[1]).ScrollTo(speed, axis, easing);
+ return false;
+ } else if(jQuery('a[@name='+parts[1]+']').size() > 0) {
+ jQuery('a[@name='+parts[1]+']').ScrollTo(speed, axis, easing)
+ return false;
+ }
}
);
+ jQuery(document).ready(
+ function() {
+ var loc = new String(document.location);
+ if (loc.search('#') != -1) {
+ var loc_parts = loc.split('#');
+ if(jQuery('#' + loc_parts[1]).size() > 0) {
+ jQuery('#' + loc_parts[1]).ScrollTo(speed, axis, easing);
+ } else if(jQuery('a[@name='+loc_parts[1]+']').size() > 0) {
+ jQuery('a[@name='+loc_parts[1]+']').ScrollTo(speed, axis, easing)
+ }
+ }
+ }
+ );
}
)
}