better javascript - attach behaviors caused page to jump forth and back