Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8519911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:23:06+00:00 2026-06-11T06:23:06+00:00

So I have this website, which was created using a sencha Editor (Sencha Animator).

  • 0

So I have this website, which was created using a sencha Editor (Sencha Animator).

They don’t really support IE for that matter, so I decided to custom edit it because most of our clients still use IE7+.

The main problems are now that it loads fine in Chrome, Safari, FF, and IE8/9
But none of the events seem to work.

I first tried to do some conditional check (which I found here) to see what browser it was and add the events like that:

function bindEvent(el, eventName, eventHandler) {
   if (el.addEventListener){
       el.addEventListener(eventName, eventHandler, false); 
   } else if (el.attachEvent){
       el.attachEvent("on"+eventName, eventHandler);
   }
}

Somehow this code suddenly breaks on

if (el.addEventListener) {

So after that I thought wait, jQuery supposedly has this build in.
So I added the CDN for jQuery from google.

in my JS I added the

$(document).ready(function () {
   // load my start function here
});

That works, so atleast the page loads all of it’s content.

Now I want to use

$(element).click(function () {
   alert('hello');
});

But that doesn’t work at all (nor does mouseup for that matter) in IE nor Firefox (IE works better then FF in this instance)

I have no clue anymore, this whole IE thing breaks about everything, and a site that only works in Chrome is just not possible… this is really really frustrating 😛

the link to the site can be found here: Link

here is the complete JS Code:

if (typeof (AN) === 'undefined') {
   AN = {};
}
AN.Controller = {
   scenes: {},
   scenesArray: [],
   currentSceneID: -1,
   olElement: null,
   events: {},
   useOrmma: false,
   setConfig: function (configData) {
      this.events = configData.events;
      this.olElement = document.getElementById(configData.parentId);
      var liElements = this.olElement.children;
      if (configData.ormma) {
        this.useOrmma = true;
    }
    var scene;
    for (var i = 0; i < configData.scenes.length; i++) {
        scene = configData.scenes[i];
        scene.element = liElements[i];
        this.scenes[scene.id] = scene;
        this.scenesArray.push(scene);
    }
    this.setupListeners();
    this.startSceneByID(this.scenesArray[0].id);
},
runningAnimationCount: 0,
browser: 'webkit',
setupListeners: function () {
    var me = this;
    var eventName = "webkitAnimationEnd";
    if (document.body.style.MozAnimationName !== undefined) {
        eventName = "animationend";
        this.browser = "moz";
    }

    function addMousemoveListenerTo(scene) {
        /*bindEvent(scene.element, 'mousemove', function (event) {
            scene.mousemoveAction(me, event);
        }, false);*/

    }
    var scene;
    for (var i = 0; i < this.scenesArray.length; i++) {
        scene = this.scenesArray[i];
        if (scene.mousemoveAction) {
            addMousemoveListenerTo(scene);
        }
    }

    function addListenerTo(element, eventType, aFunction) {
        /*bindEvent(element, eventType, function (event) {
            aFunction(me, event);
        });*/
        $("#AN-sObj-17984").live("click", function(){
            AN.Controller.startSceneByID(2);
        });
    }

    var element, event;
    for (var i = 0; i < this.events.length; i++) {
        event = this.events[i];
        element = document.getElementById(event.id);
        addListenerTo(element, event.type, event.handler);
    }
},
onAnimationEnd: function () {
    this.runningAnimationCount--;
    if (this.runningAnimationCount === 0) {
        this.onSceneFinish();
    }
},
startSceneByID: function (sceneID) {
    var me = this;
    if (sceneID === this.currentSceneID) {
        this.scenes[sceneID].element.setAttribute('class', 'run restart');
        setTimeout(function () {
            me.runningAnimationCount = me.scenes[sceneID].animationCount;
            me.scenes[sceneID].element.setAttribute('class', 'run');
            if (me.scenes[sceneID].startAction) {
                me.scenes[sceneID].startAction(me);
            }
            if (me.scenes[sceneID].animationCount === 0) {
                me.onSceneFinish();
            }
        }, 0);
        return;
    } else if (this.currentSceneID !== -1) {
        this.scenes[this.currentSceneID].element.setAttribute('class', '');
    }
    this.runningAnimationCount = this.scenes[sceneID].animationCount;
    this.currentSceneID = sceneID;
    var nextScene = this.scenes[sceneID];
    if (this.browser === 'moz') {
        nextScene.element.setAttribute('class', 'run restart');
        var unused = nextScene.element.offsetHeight;
        nextScene.element.setAttribute('class', 'run');
    } else {
        console.log(nextScene.element);
        nextScene.element.setAttribute('class', 'run');
    }
    if (this.useOrmma) {
        this.ormmaNextScene(nextScene);
    }
    if (nextScene.startAction) {
        nextScene.startAction(this);
    }
    if (nextScene.animationCount === 0) {
        this.onSceneFinish();
    }
},
replayScene: function () {
    this.startSceneByID(this.currentSceneID);
},
onSceneFinish: function () {
    if (this.scenes[this.currentSceneID].endAction) {
        this.scenes[this.currentSceneID].endAction(this);
    }
},
goToNextScene: function () {
    var nextIndex = this.scenesArray.indexOf(this.scenes[this.currentSceneID]) + 1;
    var nextScene;
    if (nextScene = this.scenesArray[nextIndex]) {
        this.startSceneByID(nextScene.id);
    }
},
goToURL: function (aURL) {
    document.location.href = aURL;
},
ormmaNextScene: function (nextScene) {
    var currentState = ormma.getState();
    if (nextScene.dimensions.expanded) {
        var maxSize = ormma.getMaxSize();
        if (currentState !== 'expanded') {
            ormma.expand({
                x: 0,
                y: 0,
                width: maxSize.width,
                height: maxSize.height
            });
        }
        var transform = "";
        var elementHeight = nextScene.element.offsetHeight;
        var elementWidth = nextScene.element.offsetWidth;
        var y = (maxSize.height - elementHeight) / 2;
        var x = (maxSize.width - elementWidth) / 2;
        transform += " translate3d(" + Math.round(x) + "px," + Math.round(y) + "px,0)";
        if (nextScene.dimensions.fit) {
            var scaleFactor = Math.min(maxSize.width / elementWidth, maxSize.height / elementHeight);
            transform += " scale3d(" + scaleFactor + "," + scaleFactor + ",1)";
        }
        nextScene.element.style.webkitTransform = transform;
    } else {
        if (currentState === 'expanded') {
            ormma.close();
        }
        ormma.resize(nextScene.dimensions.width, nextScene.dimensions.height);
    }
}
};

function loadData() {
var configData = {
    parentId: 'AN-sObj-parentOl',
    ormma: false,
    scenes: [//lots of config data
    ]
  };
  AN.Controller.setConfig(configData);
};

$(document).ready(function() {
   loadData();
   $("area[rel^='prettyPhoto']").prettyPhoto({
      social_tools: '',
      show_title: false,
      theme: 'light_rounded'
   });
});`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:23:07+00:00Added an answer on June 11, 2026 at 6:23 am

    The code:

    function bindEvent(el, eventName, eventHandler) {
       if (el.addEventListener){
           el.addEventListener(eventName, eventHandler, false); 
       } else if (el.attachEvent){
           el.attachEvent("on"+eventName, eventHandler);
       }
    }
    

    is perfectly fine. The only way it fails on if (el.addEventListener) is if el is not a DOM element.

    When I go to the actual page you’ve referenced, I see some javascript errors reported. The first happens because you are passing null for el in addListenerTo() when called from this code:

    for (var i = 0; i < this.events.length; i++) {
        event = this.events[i];
        element = document.getElementById(event.id);
        addListenerTo(element, event.type, event.handler);
    }
    

    That’s because document.getElementById(event.id); does not find an object in the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this website iloveforwards.com created using drupal. I would like to have a
So I have this website that I'm building and they are wanting to be
I have a website which was created using Microsoft Visual Studio 2010. I want
There is a website that was created using ColdFusion (not sure if this matters
I have created a website loading progress bar using Jquery UI Progress bar. This
I have one master page which applies to all pages in this website. On
I am getting JSON string from website. I have data which looks like this
I have this website http://wedessertmore.com that has some forms popup when you click on
I have a zip file that is created using drag and drop on a
I have a solution that includes a Web Site (created using the web site

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.