Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Js running on 1.7.2 but not running in 1.10.2

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #154185
    opus
    Participant

    Hi,
    Im getting crazy please help!
    I have this js running perfectly using 1.7.2 js (open a popup div when clicked on).

    When i move this code to my WP site using js 1.10.2 the link send me to an actual link instead of activating the popup.

    Any idea what can i do?

    I know this is the problem because when i change the js version to 1.10.1 on the jsfiddle example i encounter the same issue.

    #154192
    opus
    Participant

    Ok, so i changed the js version running on the WP site to 1.7.2 and still it doesn’t work! :( This is the page i am trying to run the script on.

    the link that should activate the js is in the bottom left corner of the world map (screen shot) but when you click it it tries to follow the link instead of opening the pop-up

    Please help :)

    #154207
    __
    Participant

    …when i change the js version to 1.10.1 …

    I think you’re talking about the jQuery version, yes?

    jQuery deprecated and removed its live method. Switch those calls to on instead and you’ll be fine.

    #154210
    opus
    Participant

    Thnks traq! Did it but still doesn’t activate the popup when clicked on (see here)

    I changed

    function deselect() {
    $(“.pop”).slideFadeToggle(function() {
    });
    } $(“#contact”).removeClass(“selected”);

    $(function() {
    $(“#contact”).live(‘click’, function() {
    if($(this).hasClass(“selected”)) {
    deselect();
    } else {
    $(this).addClass(“selected”);
    $(“.pop”).slideFadeToggle(function() {
    $(“#email”).focus();
    });
    }
    return false;
    });

    $(".close").live('click', function() {
        deselect();
        return false;
    });
    

    });

    $.fn.slideFadeToggle = function(easing, callback) {
    return this.animate({ opacity: ‘toggle’, height: ‘toggle’ }, “fast”, easing, callback);
    };

    to

    function deselect() { $(“.pop”).slideFadeToggle(function() { });

    } $(“#contact”).removeClass(“selected”);

    $(function() { $(“#contact”).on(‘click’, function() { if($(this).hasClass(“selected”)) { deselect(); } else { $(this).addClass(“selected”); $(“.pop”).slideFadeToggle(function() { $(“#email”).focus(); }); } return false; });

    $(".close").on('click', function() {
        deselect();
        return false;
    });
    

    });

    $.fn.slideFadeToggle = function(easing, callback) { return this.animate({ opacity: ‘toggle’, height: ‘toggle’ }, “fast”, easing, callback); };

    Any other ideas?

    #154214
    __
    Participant

    I don’t know. It works with your fiddle, which would imply there is something different on the actual page.

    The link in your fiddle has the id contact; while the link on your page has the id popup. Might be other things wrong, but that’s probably a good place to start.

    #154215
    opus
    Participant

    :( just some games i tried… even when i turn it back like in the fiddle still no luck.
    Thanks for trying…

    #154223
    __
    Participant

    Look at your function that sets this all up:

    (function($) {
        $("#contact").on('click', function() {
            if ($(this).hasClass("selected")) {
                deselect();
            } else {
                $(this).addClass("selected");
                $(".pop").slideFadeToggle(function() {
                    $("#email").focus();
                });
            }
            return false;
        });
    
        $(".close").on('click', function() {
            deselect();
            return false;
        });
    });
    

    You don’t actually call it. : )

    (function($) {
        $("#contact").on('click', function() {
            if ($(this).hasClass("selected")) {
                deselect();
            } else {
                $(this).addClass("selected");
                $(".pop").slideFadeToggle(function() {
                    $("#email").focus();
                });
            }
            return false;
        });
    
        $(".close").on('click', function() {
            deselect();
            return false;
        });
    })($);
    

    ^— see the invocation (( $ )) at the end?

    #154224
    opus
    Participant

    Tried it just now, still no luck… maybe i am missing something that calls all the function on page load or something?

    #154226
    __
    Participant

    There is an undefined variable, bdVar, on line 697 of your global.js script. Change that line from

    if( bdVar.use_fancy == 'false' ){
    

    to

    if( typeof bdVar !== 'undefined' && bdVar.use_fancy == 'false' ){
    

    To be clear, I can run your function (above) in the console, on your page, and then clicking on the link works. The code works correctly; there’s something on the page that is interfering.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.