please delete
please delete

Reputation: 13

javascript clientY

I am trying to make a div container show where my mouse is when a user mousesover a text link, but in Internet Explorer the position is different than in Firefox using the latest versions of ff and ie. Is there some new way to make a different script for these two browsers or are they going to make them the same. Right now client Y is different in the two browsers as to where the div shows up compared to the text that is moused over. I am using

<!--[if !IE]><!-->
<p>not ie</p>
<!--<![endif]-->

Am i not using this right? It says not ie in internet explorer. How do I make it so I can make clientY different in one browser than the other? this is what my javascript looks like

<script type="text/javascript">
            function closePopup(div_id) {
                var el = document.getElementById(div_id);
            }
            function toggle(div_id, height) {
                var el = document.getElementById(div_id);

                if ( el.style.display == 'none' ) { 
                    el.style.display = 'block';

            }
            function getX(event) {
                var x = event.clientX;
                return x;
            }
            function getY(event) {
                var y = event.clientY;
                return y;
            }
            function window_pos(element, x, y, width, height) {
                var el = document.getElementById(element);
                el.style.position = "absolute";
                el.style.left = ""+setX(x-parseInt(width, 10)/2)+"px";
                el.style.top = ""+setY(y-parseInt(height, 10)/2, height)+"px";
            }
            function setX(x) {
                return window.pageXOffset+x;
            }
            function setY(y, h) {
                return window.pageYOffset+y-parseInt(h);
            }
            function popup(element, event) {
                var el = document.getElementById(element);
                var width = el.style.width;
                var height = el.style.height;
                var positiona = [];
                window_pos(element, getX(event), getY(event), width, height);
                toggle(element, height);     
            }
        </script>

Upvotes: 0

Views: 84

Answers (1)

please delete
please delete

Reputation: 13

If anyone has any problems with clienty with wordpress and you are using the 2014 theme

<link rel='stylesheet' id='twentyfourteen-style-css'  href='http://test.earnmoneyfromwebsite.com/wp-content/themes/twentyfourteen/style.css?ver=3.8' type='text/css' media='all' />

this is what causes it to be different in different browsers and change based on the size of the screen

Upvotes: 1

Related Questions