Testing change to cart popup display system. Attempting to fix display flakiness associated with YUI method.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Owen Leonard 2008-06-18 10:56:30 -05:00 committed by Joshua Ferraro
parent d8c60f6bdf
commit a0dfa0e5a6
4 changed files with 40 additions and 29 deletions

View file

@ -1266,8 +1266,11 @@ div#changelanguage a.yuimenuitemlabel {
background-color : #FFF;
border: 1px solid #739acf;
color : black;
padding : .3em;
display : none;
margin : 0;
padding : 10px;
text-align : center;
width : 180px;
}
.yui-panel .hd, .yui-panel .bd, .yui-panel .ft {

View file

@ -14,6 +14,9 @@
<script type="text/javascript" src="<!-- TMPL_VAR NAME="yuipath" -->/menu/menu-min.js"></script>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/jquery.js"></script>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/ui.tabs.js"></script>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.dimensions.js"></script>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.hoverIntent.minified.js"></script>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.dropshadow.js"></script>
<!-- TMPL_IF NAME="AmazonContent" --><script type="text/javascript" language="javascript" src="<!-- TMPL_VAR NAME="themelang" -->/js/amazonimages.js"></script><!-- /TMPL_IF -->
<script type="text/javascript" language="javascript" src="<!-- TMPL_VAR NAME="themelang" -->/js/script.js"></script>
<script type="text/javascript" language="javascript"

View file

@ -82,7 +82,7 @@
</div>
</div>
<!-- TMPL_IF NAME="opacbookbag" --><div id="cartDetails" style="visible:false;">Your cart is empty.</div><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="opacbookbag" --><div id="cartDetails">Your cart is empty.</div><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="virtualshelves" -->
<div id="listsmenu" class="yuimenu" style="display: none">

View file

@ -204,11 +204,10 @@ function addSelRecords(valSel) { // function for adding a selection of biblios t
}
function showCartUpdate(msg){
cartUpdate.setBody(msg);
cartUpdate.render("cc");
cartUpdate.show();
YAHOO.util.Event.addListener("cartUpdate", "click", cartUpdate.hide, cartUpdate, true);
setTimeout("cartUpdate.hide()",5000);
// set body of popup window
$("#cartDetails").html(msg);
showCart();
setTimeout("hideCart()",2000);
}
function selRecord(num, status) {
@ -367,10 +366,10 @@ function showLess() {
function updateBasket(updated_value,target) {
if(target){
target.$('#basket').html("<span>"+updated_value+"</span>");
target.$('#basketcount').html("<span>"+updated_value+"</span>");
target.$('#cartDetails').html(_("Your cart contains ")+updated_value+_(" items"));
} else {
$('#basket').html("<span>"+updated_value+"</span>");
$('#basketcount').html("<span>"+updated_value+"</span>");
$('#cartDetails').html(_("Your cart contains ")+updated_value+_(" items"));
}
var basketcount = updated_value;
@ -409,24 +408,30 @@ function vShelfAdd() {
}
}
YAHOO.util.Event.onAvailable("cartDetails", function () {
$("#cartDetails").css("display","block").css("visibility","hidden").after("<div id=\"cc\" style=\"visibility: hidden\"></div>");
$("#cmspan").html("<a href=\"#\" id=\"cartmenulink\" class=\"\"><i></i><span><i></i><span></span><img src=\"/opac-tmpl/prog/images/cart.gif\" width=\"14\" height=\"14\" alt=\"\" border=\"0\" />" + $("#cmspan").text() + "<span id=\"basket\"></span></span></a>");
if(basketcount){ updateBasket(basketcount) }
});
function cartMenuInit() {
$('#cartmenulink').click(function(){
openBasket(); return false;
});
// Build cartOverlay based on markup
$("#cartDetails").css("display","block");
cartOverlay = new YAHOO.widget.Overlay("cartDetails", { context:["cartmenulink","tr","br"], visible:false,width:"200px",effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );
cartOverlay.render();
YAHOO.util.Event.addListener("cartmenulink", "mouseover", cartOverlay.show, cartOverlay, true);
YAHOO.util.Event.addListener("cartmenulink", "mouseout", cartOverlay.hide, cartOverlay, true);
YAHOO.util.Event.addListener("cartmenulink", "click", cartOverlay.hide, cartOverlay, true);
cartUpdate = new YAHOO.widget.Panel("cartUpdate", { context:["cartmenulink","tr","br"], visible:false,draggable:false, close:false,width:"200px",effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25} } );
function showCart(){
var position = $("#cartmenulink").offset({border: true,margin:false});
var top = position.top + 16; // $("#cartmenulink").outerHeight();
var left = position.left - 105;
$("#cartDetails").css("position","absolute").css("top",top);
$("#cartDetails").css("position","absolute").css("left",left);
$("#cartDetails").fadeIn("fast",function(){
$("#cartDetails").dropShadow({left: 3, top: 3, blur: 0, color: "#000", opacity: 0.1});
});
}
YAHOO.util.Event.addListener(window, "load", cartMenuInit);
function hideCart(){
$(".dropShadow").hide();
$("#cartDetails").fadeOut("fast");
}
$("#cartDetails").ready(function(){
$("#cmspan").html("<a href=\"#\" id=\"cartmenulink\" class=\"\"><i></i><span><i></i><span></span><img src=\"/opac-tmpl/prog/images/cart.gif\" width=\"14\" height=\"14\" alt=\"\" border=\"0\" /> Cart<span id=\"basketcount\"></span></span></a>");
$("#cartDetails,#cartmenulink").click(function(){ hideCart(); });
$("#cartmenulink").click(function(){ openBasket(); return false; });
$("#cartmenulink").hoverIntent(function(){
showCart();
},function(){
hideCart();
});
if(basketcount){ updateBasket(basketcount) }
});