Plugin Directory

Changeset 1377742


Ignore:
Timestamp:
03/24/2016 09:38:11 AM (10 years ago)
Author:
k00ni
Message:

added bug fixes and more stability

bug fixes:

  • if no CSS class to ignore is set, the plugin no longer

ignores clicks to anchors entirely

stability:

  • checks, if jQuery is available, otherwise a simple warning

gets print on via console.log

Location:
fixed-menu-anchor/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fixed-menu-anchor/trunk/fixed-menu-anchor.php

    r1373147 r1377742  
    88 * Plugin Name: Fixed Menu Anchor
    99 * Plugin URI: https://wordpress.org/plugins/fixed-menu-anchor
    10  * Version: 2.0.3
     10 * Version: 2.0.4
    1111 * Description: Having problems with a fixed header/menu which overlaps the target of an anchor? Use this plugin to jump just before the target so that the fixed header/menu does not overlap anymore.
    1212 * Author: Konrad Abicht, Marc Sauerwald
     
    1818
    1919if (!defined('FIXEDMENUANCHOR_VERSION')) {
    20     define('FIXEDMENUANCHOR_VERSION', '2.0.3');
     20    define('FIXEDMENUANCHOR_VERSION', '2.0.4');
    2121}
    2222
  • fixed-menu-anchor/trunk/js/fixed-menu-anchor.js

    r1368514 r1377742  
    22 * That file is part of the fixed-menu-anchor plugin.
    33 */
    4 jQuery(document).ready(function(){
    5     // dive into click events for anchors
    6     jQuery('a[href*=#]').click(function(e){
     4if (typeof jQuery != 'undefined') {
     5    jQuery(document).ready(function(){
     6        // dive into click events for anchors
     7        jQuery('a[href*=#]').click(function(e){
    78
    8         // stop execution in case, the user wants to ignore elements with a certain
    9         // CSS class.
    10         if (jQuery(this).hasClass(fixedMenuAnchorCssClassesToBeIgnored)) {
    11             return;
    12         }
     9            // stop execution in case, the user wants to ignore elements with a certain
     10            // CSS class.
     11            if (jQuery(this).hasClass(fixedMenuAnchorCssClassesToBeIgnored)
     12                && '' != fixedMenuAnchorCssClassesToBeIgnored) {
     13                return;
     14            }
    1315
    14         // get top-left position of the target element on the screen
    15         var top = fixedMenuAnchor_getTopValueOfAnchorTarget(jQuery, this);
     16            // get top-left position of the target element on the screen
     17            var top = fixedMenuAnchor_getTopValueOfAnchorTarget(jQuery, this);
    1618
    17         // get distance(user defined) between anchor-target and screen-top.
    18         var distance = fixedMenuAnchor_getDistance(window.innerWidth);
     19            // get distance(user defined) between anchor-target and screen-top.
     20            var distance = fixedMenuAnchor_getDistance(window.innerWidth);
    1921
    20         // move the screen to the top coordinate minus the user given distance
    21         jQuery('html, body').animate({scrollTop: top - distance}, 500);
     22            // move the screen to the top coordinate minus the user given distance
     23            jQuery('html, body').animate({scrollTop: top - distance}, 500);
     24        });
    2225    });
    23 });
     26} else {
     27    console.log('jQuery is not loaded therefore the Fixed Menu Anchor plugin was set inactive.');
     28}
    2429
    2530/**
  • fixed-menu-anchor/trunk/readme.txt

    r1373120 r1377742  
    6060== Changelog ==
    6161
     62= 2.0.1 - 2.0.4=
     63* Bug fixing
     64* removed unneccessary files  (e.g. documentation of used vendors)
     65
    6266= 2.0.0 =
    6367* Added new features:
    6468  * you can now define a maximum viewport width until a certain distance is to be used (only pro version).
    6569  * you can define a certain CSS-class, when it is attached on a link, the click event will be ignored
     70* implemented test environment on PHP and JavaScript level to improve stability and reduce bugs
    6671* tested plugin if compatible with standard theme of WordPress 4.4.2
    6772* added shortcut in plugin view to reach settings page faster after activation
Note: See TracChangeset for help on using the changeset viewer.