Hello. I'm Aleksandar Vacić, professional web developer and wine maker in the making.
Learn more about me or see what I can do for you.

My work & services

Archive for the 'WCH' category

Small bug fix

Building upon the techniques I wrote about, WCH is recoded in such manner. By itself, this would not warrant an entry, but I also introduced one change.

Previously, when you first call WCH.Apply("layer", "cont"), it would create an iFrame with an id of WCHhiderlayer. It will also position the iFrame to be the exact size and at exact position (exact…more or less) as the layer is (minding the positioned container). All fine until now.

However, if the layer changes its position or size, its corresponding WCH layer will not. I noticed this bug when testing out ADxMenu behavior when window is resized.

Apply method now has 3rd parameter, bResize. If its value is true, and the iFrame needed already exists, sizing and positioning will be repeated.

this.Apply = function(vLayer, vContainer, bResize) {
  ...
  if ( _bIE55 &&
    (oIframe = _Hider(vLayer, vContainer, bResize)) ) {
  ...
};
...
function _Hider(vLayer, vContainer, bResize) {
  ...
  if ( !oIframe ) {
    ...
  } else if (bResize) {
    _SetPos(oIframe, oLayer);
  }
  ...
};

Now you just need to decide when should this parameter be true.

WCH3. Works in IE5.0+

I have to stop giving definitive sentences. I just decided recently that I’m gonna develop two version of WCH2, and than Tim Connor spoils it all and hands the idea of short and sweet way of covering IE5.01, without too much code. Oh well. :)

So, now I have 3rd generation of WCH, which covers IE5.0 and later. Also, I took the opportunity to rewrite the script the same way as ADxMenu. WCH is now an object, and you simply call its methods.

Take a look at this extensive example, where WCH successfully works with:

  • drop-downs
  • Flash movies
  • Quicktime video

As a side note…did you notice the W3C Schools are recommending non-standard way of including Flash or other media objects? Shameful. :(

How to use it

You need to include the WCH.js in your page, and then simply call the methods. I have renamed the functions to be less confusing.

WCH.Apply(Layer, Container);
WCH.Discard(Layer, Container);

So, when you are showing your layer, just call Apply method. When you are removing your layer, simply call Discard method.

News is that both parameters can either be an id or a reference. WCH will internally fetch the reference if id is passed.

Continue reading WCH3. Works in IE5.0+

WCH 2.5IE 5.0 support

From this moment on, I will maintain two version of the WCH2 script. One will support IE 5.5+ (version 2.0x) and other will support IE 5.0+ (version 2.5x). In IE 5.0 we need to hide the windowed controls when absolute layers popup, and show them again then layers are removed.

Basic idea

My goal was to make the life of web page builder as simple as possible. Therefore, the only thing you need to do is to add the class name WHChider (case-sensitive) to the elements that needs to be hidden when layer pops up.

<select ... class="WCHhider">
<select ... class="sample WCHhider">

As you can see, even if you already have a class, just add this one too. IE 5.0 supports multiple class names.

Check-out this example, which shows what WCH2 does.

Continue reading WCH 2.5IE 5.0 support

WCH 2

After the last post, I knew that only IE/Win had any benefit from this script. This way I was able to streamline the script and completely remove the dependency on other scripts. It’s not even needed to do anything on the page load. I also removed the support for IE 5.0 and concentrated on iFrame technique. And it’s a lot smaller: 4.65kB, heavily commented.

Script now has only three functions. WCH_Hider() does all the browser checks and creates the hiding iFrame. WCH_HideWndCtrl() is placing the hider below the layer that needs to go over windowed controls. WCH_ShowWndCtrl is removing the hider.

For those of you wondering what this is all about…read this entry that will explain the problem at hand. Now, on to version 2. I will still explain every part of the script, as I think that this version should be used in the future – it’s much smaller, faster, independent…simply better.

Continue reading WCH 2

SSL fix for IE

I today encountered a problem with Internet Explorer (oh, well, I know). I used ADxMenu on the page that was under SSL. Page loads fine. Then, I hover the menu actuator, which brings up the famous dialog:

This page contains both secure and non secure items.

Do you want to display the non secure items?

There was nothing wrong with the menu, but with WCH script. If you remember, it creates iFrame element on the fly and places it below the menu.

Well, if you don’t have the src specified for the iFrame, IE treats it as unsecure item, hence the dialog. Solution is simple, as usual (once you find out what is the problem):

oHiderContainer.insertAdjacentHTML("afterBegin",
   '<iframe src="/inc/e.html" id=...></iframe>');

Rest of the line stays the same. This e.html is a simple empty file already present in the project. Use anything you want.

Tags or categories or topics...