Friday, August 23, 2013

IE 6/7/8 workaround for custom radio buttons and checkboxes causes page to scroll up

When our client was testing their web site we got feedback regarding a weird scrolling issue that occured when they clicked custom radio buttons and checkboxes. This didn't occur in all browsers, only in Internet Explorer 6, 7 and 8.

The original workaround

The original problem was, and still is for these older IE versions, that when you add custom design to radio buttons and checkboxes you can't use display: none or visibility:hidden to hide the underlying input element. This is because when clicking the label element, IE wont trigger the checked attribute to be set on the input element. So the usual workaround is to still have the input element visible and displayed and instead using something like margin: -10000px or top: -5000px with position: absolute.

The following issue

In your IE 6/7/8 css you have the above mentioned workaround. Everything works fine, you can use the custom checkboxes and radio buttons. 

But wait, there's more.

Since the solution was to use margin: -10000px or top: -5000px - when you click the label at the custom design buttons/boxes IE will focus the browser to the height of the underlying input element that was associated with the label that the user just clicked. 

The result is, if you click the custom button/box when you also have scrolled down a bit, you the browser scrolls back to the top. Because as I mentioned, when the label is clicked, the input field becomes focused.

The final solution

The final solution is nothing special. Just instead of using margin: 10000px or top: -5000px. Use left: -5000px. So the height is as expected, the same height as the original position. The left position just causes it to not be seen by the user. No more weird scrolling when clicking the custom radio button or checkbox, woho!

Wednesday, August 21, 2013

Hidden gems

Some times you just stumble upon a small feature that makes you smile all day. This morning I found one of those.

The pretty print or Javascript formatter buttons. They format the minified script and css files for you so you can debug production sites.
Both IE 10 and Chrome has them. I couldn't find a similar function in Firefox.

In IE you can find it under the script tools button and then selecting Format JavaScript.

 In Chrome the button is more accessible. It's the small { } button at the bottom that silently sits beside the other tools, just waiting for you to click it.

It's a small thing but it sure helped me, I hope it helps make other people smile today :)

Wednesday, August 7, 2013

Shape your destiny through questions

Questions we ask ourselves dictate our mindset, behavior, and energy level. Tony Robbins enlightens us in Awaken the Giant Within, "Questions immediately change what we're focusing on and therefore how we feel. They are the laser of human consciousness. They concentrate our focus and determine what we feel and do."

Up for an experiment? Try these!

The Morning Power Questions 

The following questions are designed to cause you to experience more happiness, excitement, pride, gratitude, joy commitment, and love every day of your life. Remember, quality questions create a quality life.
Come up with two or three answers to all of these questions and feel fully associated. If you have difficulty discovering an answer simply add the word "could." Example: "What could I be most happy about in my life now?
1. What am I happy about in my life now? What about that makes me happy? How does that make me feel?
2. What am I excited about in my life now? What about that makes me excited? How does that make me feel?
3. What am I proud about in my life now? What about that makes me proud? How does that make me feel?
4. What am I grateful about in my life now? What about that makes me grateful? How does that make me feel?
5. What am I enjoying most in my life right now? What about that do I enjoy? How does that make me feel?
6. What am I committed to in my life right now? What about that makes me committed? How does that make me feel?
7. Who do I love? Who loves me? What about that makes me loving? How does that make me feel?

The Evening Power Questions 

1. What have I given today? In what ways have I been a giver today?
2. What did I learn today?
3. How has today added to the quality of my life or how can I use today as an investment in my future?
Repeat the morning questions (optional)