我已經構建並排序了輸出當前變量的對象,如下所示。當帳單信息地址和送貨地址相同時的警報
我想警惕......兩個div突出顯示爲綠色。我假設我需要合併一些jquery ..這裏是我有什麼:
<div class='address_info left'>
<h3>Billing Info</h3>
<ul>
<li><label>Account No: </label><?php echo $order->patient_id;?></li>
<li><label>Name: </label><?php echo trim($order->billing_address['name']); ?></li>
<li><label>Address 1: </label><?php echo trim($order->billing_address['addr1']);?></li>
<li><label>Address 2: </label><?php echo trim($order->billing_address['addr2']);?></li>
<li><label>City, State, Zip:</label><?php echo trim($order->billing_address['city'] . ' ' . $order->billing_address['state'] . ' ' . $order->billing_address['zip']);?></li>
<li><label>Email: </label><a href='mailto:<?php echo $order->customer_email;?>'>Send Customer Email</a></li>
<li><label>Phone: </label><?php echo $order->customer_phone;?></li>
</ul>
</div>
<div class='address_info right'>
<h3>Shipping Info</h3>
<ul>
<li><label>Name: </label><?php echo $order->shipping_address['name']; ?></li>
<li><label>Address 1: </label><?php echo $order->shipping_address['addr1'];?></li>
<li><label>Address 2: </label><?php echo $order->shipping_address['addr2'];?></li>
<li><label>City, State, Zip:</label><?php echo $order->shipping_address['city'] . ' ' . $order->shipping_address['state'] . ' ' . $order->shipping_address['zip']?></li>
<li><label></label></li>
<li><label></label></li>
<li><label></label></li>
</ul>
</div>
我目前使用懸停的顏色一些CSS。
div.address_info.left:hover {
background: red;
color: #fff; }
div.address_info.right:hover {
background: #5C991F;
color: #fff; }
div.order_info:hover {
background: #3366FF;
color: #fff; }
因此,這裏是我的更新:
if (count(array_diff($this->billing_address, $this->shipping_address)) > 0)
return false;
else
return true;
我想我真正的問題是如何在我的數據運行的jQuery事件。對不起,在開始時再次模糊不清。我想我們沒有右腳下。雖然會喜歡jQuery的一些幫助。提前致謝。
感謝您的所有幫助..我想通了!
if($order->check_addresses())
$class='same';
else
$class='different';
<div class='address_info left <?php echo $class; ?>'>
<div class='address_info right <?php echo $class; ?>'>
,比CSS
div.same {background-color: green;}
div.different {background-color: red;}
[你有什麼嘗試?](http://www.whathaveyoutried.com/)請參閱[常見問題]。 –
打我吧,^ –
我建議:使用PHP來判斷內容是否相同。如果是這樣,請將CSS類應用於DIVS以指示相同的內容。 – showdev