Difference between revisions of "Team:NAIT Edmonton/Trial11"

Line 8: Line 8:
 
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
 
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="https://2015.igem.org/Team:NAIT_Edmonton/popupboxjquery?action=raw&amp;ctype=text/javascript"></script>
 
<script type="text/javascript">
 
  
$(function() {
 
    var moveLeft = 0;
 
    var moveDown = 0;
 
    $('a.popper').hover(function(e) {
 
 
 
        var target = '#' + ($(this).attr('data-popbox'));
 
       
 
        $(target).show();
 
        moveLeft = $(this).outerWidth();
 
        moveDown = ($(target).outerHeight() / 2);
 
    }, function() {
 
        var target = '#' + ($(this).attr('data-popbox'));
 
        $(target).hide();
 
    });
 
 
    $('a.popper').mousemove(function(e) {
 
        var target = '#' + ($(this).attr('data-popbox'));
 
       
 
        leftD = e.pageX + parseInt(moveLeft);
 
        maxRight = leftD + $(target).outerWidth();
 
        windowLeft = $(window).width() - 40;
 
        windowRight = 0;
 
        maxLeft = e.pageX - (parseInt(moveLeft) + $(target).outerWidth() + 20);
 
       
 
        if(maxRight > windowLeft && maxLeft > windowRight)
 
        {
 
            leftD = maxLeft;
 
        }
 
   
 
        topD = e.pageY - parseInt(moveDown);
 
        maxBottom = parseInt(e.pageY + parseInt(moveDown) + 20);
 
        windowBottom = parseInt(parseInt($(document).scrollTop()) + parseInt($(window).height()));
 
        maxTop = topD;
 
        windowTop = parseInt($(document).scrollTop());
 
        if(maxBottom > windowBottom)
 
        {
 
            topD = windowBottom - $(target).outerHeight() - 20;
 
        } else if(maxTop < windowTop){
 
            topD = windowTop + 20;
 
        }
 
   
 
        $(target).css('top', topD).css('left', leftD);
 
   
 
   
 
    });
 
 
});
 
</script>
 
  
 
</head>
 
</head>
Line 224: Line 174:
  
 
</style>
 
</style>
 +
 +
 +
<script src="https://2015.igem.org/Team:NAIT_Edmonton/popupboxjquery?action=raw&amp;ctype=text/javascript"></script>
 +
 +
<script type="text/javascript">
 +
 +
$(function() {
 +
    var moveLeft = 0;
 +
    var moveDown = 0;
 +
    $('a.popper').hover(function(e) {
 +
 
 +
        var target = '#' + ($(this).attr('data-popbox'));
 +
       
 +
        $(target).show();
 +
        moveLeft = $(this).outerWidth();
 +
        moveDown = ($(target).outerHeight() / 2);
 +
    }, function() {
 +
        var target = '#' + ($(this).attr('data-popbox'));
 +
        $(target).hide();
 +
    });
 +
 +
    $('a.popper').mousemove(function(e) {
 +
        var target = '#' + ($(this).attr('data-popbox'));
 +
       
 +
        leftD = e.pageX + parseInt(moveLeft);
 +
        maxRight = leftD + $(target).outerWidth();
 +
        windowLeft = $(window).width() - 40;
 +
        windowRight = 0;
 +
        maxLeft = e.pageX - (parseInt(moveLeft) + $(target).outerWidth() + 20);
 +
       
 +
        if(maxRight > windowLeft && maxLeft > windowRight)
 +
        {
 +
            leftD = maxLeft;
 +
        }
 +
   
 +
        topD = e.pageY - parseInt(moveDown);
 +
        maxBottom = parseInt(e.pageY + parseInt(moveDown) + 20);
 +
        windowBottom = parseInt(parseInt($(document).scrollTop()) + parseInt($(window).height()));
 +
        maxTop = topD;
 +
        windowTop = parseInt($(document).scrollTop());
 +
        if(maxBottom > windowBottom)
 +
        {
 +
            topD = windowBottom - $(target).outerHeight() - 20;
 +
        } else if(maxTop < windowTop){
 +
            topD = windowTop + 20;
 +
        }
 +
   
 +
        $(target).css('top', topD).css('left', leftD);
 +
   
 +
   
 +
    });
 +
 +
});
 +
</script>
  
 
</body>
 
</body>

Revision as of 05:50, 23 July 2015