所以我终于想出了如何做我想做的事。
这是一个小提琴:http: //jsfiddle.net/XPgdx/
这是jQuery:
$j(".result_details_button").click(function () {
var msg = "There are no sites associated with this service.";
var popout = $j("#search_results_details");
$j(".result_details_button").not(this).parent().removeClass("active_highlight").parent().removeClass("active_details");
if($j("#search_results_details").is(":visible") && $j(this).parent().hasClass("active_highlight"))
{
popout.html(msg).html($j(this).parent().toggleClass("active_highlight").parent().toggleClass("active_details").find($j(".sites")).html()).hide();
}
else
{
popout.html(msg).html($j(this).parent().toggleClass("active_highlight").parent().toggleClass("active_details").find($j(".sites")).html()).show();
};
});
和 HTML:
<div class="col_left">
<div class="search_result">
<div class="result_details">
<div class="result_details_button"> Sites >></div>
</div>
<p>This is a search result</p>
<div class="sites">Info here</div>
</div>
</div>
<div class="col_right">Map data here</div>
<div id="search_results_details">This is the popout div where the sites will populate.</div>
对于笑容,CSS:
.search_result, #paginationControl { padding: 15px 0; border-top: 1px solid #ddd; position: relative;}
.search_result .service { font-size: 18px; font-weight: bold; }
.search_result .service .small { margin-left: 5px; }
.search_result .description { margin: 2px 0; font-size: 12px; color: #222; margin-right: 75px; }
.search_result .description b { color: #000; }
.search_result .small_icon { width: 10px; height: 10px; margin-right: 2px; }
.sites { font-size: 12px; display: none; }
.site_name { font-size: 14px; font-weight: bold; }
.site_block { float:left; border: 2px solid #ccc; border-radius: 4px; margin: 5px 10px 5px 0; padding: 5px; width: auto; background-color: #fff; height: auto; overflow-y: auto; }
.site_name { font-size: 14px; font-weight: bold; }
.result_details {
background: none repeat scroll 0 0 transparent;
bottom: 0;
cursor: default;
height: auto;
margin: 0;
min-height: 40px;
padding-left: 9px;
padding-right: 4px;
position: absolute;
right: 0px;
top: -2px;
width: 65px;
}
.result_details_button {
height: 13px;
margin-left: 6px;
margin-top: -7px;
opacity: 0.3;
position: absolute;
top: 50%;
}
.result_details_button:hover {
opacity: 0.6;
}
#search_results_details {
background: #efefef;
border-left: solid 1px #ddd;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: auto;
margin-left: 67%;
padding: 10px;
padding-top: 20px;
display: none;
box-shadow: 0px 0px 10px 5;
}
.active_details { z-index: 999; }
.active_highlight { background-color: #efefef; }