Plugin Directory

Changeset 1600311


Ignore:
Timestamp:
02/21/2017 05:54:18 AM (9 years ago)
Author:
skoldin
Message:

Fix the previous commit

Location:
click-to-scroll/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • click-to-scroll/trunk/assets/js/front.js

    r1600288 r1600311  
    1919        if ( jsSettings && +jsSettings.scroll_to_anchor === 1) {
    2020            $('a[href*="#"]').not('a[href="#"]').not('a[href$="#"]').on('click', function (e) {
    21                 e.preventDefault();
    22 
    2321                var url = $(this).attr('href'),
    2422                    selector = url.slice(url.indexOf('#')),
     23                    unhashedUrl = url.slice(0, url.indexOf('#')),
     24                    location = document.location.href,
     25                    unhashedLocation = location.slice(0, location.indexOf('#')),
    2526                    $elem = $(selector);
     27
     28                // if the URL contains not only hash, check if we are on the same page
     29                if( location !== unhashedUrl && unhashedLocation !== unhashedUrl ) {
     30                    return;
     31                }
     32
     33                e.preventDefault();
    2634
    2735                if( $elem.length ) {
  • click-to-scroll/trunk/assets/js/front.min.js

    r1600288 r1600311  
    1 (function(b){var c=b(".js_settings").val(),d=b(".cts-button"),f=(c=c?JSON.parse(c):null)&&c.animation_speed?parseInt(c.animation_speed):400;b(window).load(function(){d.on("click",function(a){a.preventDefault();b("html, body").animate({scrollTop:0},f,"linear")});if(c&&1===+c.scroll_to_anchor)b('a[href*="#"]').not('a[href="#"]').not('a[href$="#"]').on("click",function(a){a.preventDefault();a=b(this).attr("href");a=a.slice(a.indexOf("#"));var e=b(a);if(e.length){a=e.offset().top;var d=b("#wpadminbar");
    2   d.length&&"fixed"===d.css("position")&&(a-=d.height());c.global_offset&&(a-=parseInt(c.global_offset));(e=e.data("offset"))&&(a-=parseInt(e));b("html, body").animate({scrollTop:a},f,"linear")}})});b(window).on("scroll",function(){var a=b(window).height()/2;b("body").scrollTop()>a?d.addClass("active"):d.removeClass("active")})})(jQuery);
     1(function(a){var d=a(".js_settings").val(),e=a(".cts-button"),g=(d=d?JSON.parse(d):null)&&d.animation_speed?parseInt(d.animation_speed):400;a(window).load(function(){e.on("click",function(c){c.preventDefault();a("html, body").animate({scrollTop:0},g,"linear")});if(d&&1===+d.scroll_to_anchor)a('a[href*="#"]').not('a[href="#"]').not('a[href$="#"]').on("click",function(c){var b=a(this).attr("href"),f=b.slice(b.indexOf("#")),b=b.slice(0,b.indexOf("#")),e=document.location.href,h=e.slice(0,e.indexOf("#")),
     2f=a(f);if(e===b||h===b)c.preventDefault(),f.length&&(c=f.offset().top,b=a("#wpadminbar"),b.length&&"fixed"===b.css("position")&&(c-=b.height()),d.global_offset&&(c-=parseInt(d.global_offset)),(f=f.data("offset"))&&(c-=parseInt(f)),a("html, body").animate({scrollTop:c},g,"linear"))})});a(window).on("scroll",function(){var c=a(window).height()/2;a("body").scrollTop()>c?e.addClass("active"):e.removeClass("active")})})(jQuery);
  • click-to-scroll/trunk/readme.txt

    r1600288 r1600311  
    6161== Changelog ==
    6262
    63 = 1.3.1 =
     63= 1.3.2 =
    6464* Fix: enabled scroll anchor option might be ignored
    6565* Fix: scroll to anchor even if the URL contains not only hash
Note: See TracChangeset for help on using the changeset viewer.