需要此幫助的幫助,我的頭幾天纔開始工作。jQuery同位素選擇/展開的內部超鏈接
參考此演示http://jsfiddle.net/8QkEw/313/,如何修改我的代碼以使內部超鏈接在展開/選定itemSelector保持展開/選定狀態時可以工作。
$(function(){
var $container = $('#container'),
$items = $('.item');
$container.isotope({
itemSelector: '.item',
masonry: {
columnWidth: 100
},
getSortData : {
selected : function($item){
// sort by selected first, then by original order
return ($item.hasClass('selected') ? -500 : 0) + $item.index();
}
},
sortBy : 'selected'
})
$items.click(function(){
var $this = $(this);
// don't proceed if already selected
var $previousSelected = $('.selected');
if (!$this.hasClass('selected')) {
$this.addClass('selected');
}
$previousSelected.removeClass('selected');
// update sortData for new items size
$container
.isotope('updateSortData', $this)
.isotope('updateSortData', $previousSelected)
.isotope();
});
});
只有當用戶點擊內部超鏈接時不會最小化展開/選擇的框;點擊其他區域仍然會觸發$previousSelected.removeClass('selected');
在此先感謝。在鏈接
非常感謝,它完美的作品,非常感謝 –