0
我有一個非常標準的滑塊組件滑塊UL。在滑塊div中查找可見元素
我想將活動類添加到視口中只有可見元素。我嘗試了谷歌搜索,但所有在vail。有沒有人能夠對此有所瞭解?
以下是滑動代碼:
// get all lists that slider was initialised on
$lists = $(this.container).find('> ul');
// get current left position of list
currentPos = $lists.position().left;
// new left position of list is width of a page times target page number
newLeftPos = currentPos - (530 * (newPageNum-1));
我不認爲這會工作,因爲李的總是可見的? – RuntimeException
視口中的可見元素http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport – Sbml
謝謝,你提供的最後一個鏈接確實工作。謝謝。 – RuntimeException