我有三个div类我正在使用isotope jquery来过滤数据库中的数据。当jquery set static工作正常但是我使用sqlquery控制过滤器时它不可能得到解决方案..如果你有想法plzzz分享以及如何过滤数据
我的Html:
<div class="container">
<div class="block-content block-content-small-padding">
<div class="block-content-inner">
<h2 class="center">Recent Properties</h2>
<ul class="properties-filter">
<li class="selected"><a href="#" data-filter="*"><span>All</span></a></li>
<li><a href="#" data-filter=".property-featured" ><span>Featured</span></a></li>
<li><a href="#" data-filter=".property-rent" ><span>Rent</span></a></li>
<li><a href="#" data-filter=".property-sale" ><span>Sale</span></a></li>
</ul>
<div class="properties-items isotope" style="position: relative; overflow: hidden; height: 810px;">
<div class="row ">
@foreach($val as $value)
<div class="property-item col-sm-6 col-md-3 isotope-item" style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
<div class="property-box">
<div class="property-box-inner">
<h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
<h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
<div class="property-box-picture">
<div class="property-box-price">{{$value->property_price}}</div>
<div class="">
<a href="#" class="property-box-picture-target">
<img src="images/test/{{$value->image}}" alt="">
</a>
</div>
</div>
</div>
</div>
</div>
<div class="property-item property-rent col-sm-6 col-md-3 isotope-item" id="rent" style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
<div class="property-box">
<div class="property-box-inner">
<h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
<h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
<div class="property-box-picture">
<div class="property-box-price">{{$value->property_price}}</div>
<div class="">
<a href="#" class="property-box-picture-target">
<img src="images/test/{{$value->image}}" alt="">
</a>
</div>
</div>
</div>
</div>
</div>
<div class="property-item property-sale col-sm-6 col-md-3 isotope-item" style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
<div class="property-box">
<div class="property-box-inner">
<h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
<h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
<div class="property-box-picture">
<div class="property-box-price">{{$value->property_price}}</div>
<div class="">
<a href="#" class="property-box-picture-target">
<img src="images/test/{{$value->image}}" alt="">
</a>
</div>
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
</div>
控制器:
public function index()
{
$view=DB::table('property_details')
->get();
return View::make('index', array('val'=>$view));
}
public function rentshow()
{
$view=DB::table('property_details')
->where('sale_or_rent','=','rent')
->get();
return View::make('index', array('val'=>$view));
}
public function saleshow()
{
$view=DB::table('property_details')
->where('sale_or_rent','=','sale')
->get();
return View::make('index', array('val'=>$view));
}
路线:
Route::get('/', array('as' => 'pages', 'uses' => 'PageController@index'));
Route::get('rentshow', array('as' => 'rentshow', 'uses' => 'PageController@rentshow'));
Route::get('saleshow', array('as' => 'saleshow', 'uses' => 'PageController@saleshow'));