“irow =” “rowofvideos =” rgFinal.join (”); “htmltoset =” getStartOfHtml () “/>
Sunday, May 5, 2013
TechBit: Google Now arrives for iPhone and iPad - Washington Post (blog)
“; / / $ (“# StoriesConnector”). Html (rowOfVideos); var jCarousel = $ (“# recommended-videos-module”). after (htmlToSet); / / JCarousel.find (‘. Carousel-control-prev’). Click (function () {alert (“Clicked prev”);}); / / $ (JCarousel). Find (‘. Carousel-control-prev’). Click (function () {alert (“Clicked prev2″);}); $ (‘# Btn-prev’). Click (function () { / / Alert (“button prev was clicked”); moveCarousel (findRowContainer (this), -1); }); $ (‘# Btn-next’). Click (function () { / / Alert (“button next was clicked”); moveCarousel (findRowContainer (this), 1); }); }); function findRowContainer (clicked) { return $ (clicked). parents (‘. panel.postMost’). find (‘. stories-container’); } function findCurrentRow (rowContainer) { return rowContainer.children (‘. on’). first (); } function findIndexLastRow (rowContainer) { var rowCount = rowContainer.children (). length; return rowCount == 0? 0: rowCount – 1; } function moveCarousel (rowContainer, delta) { / / Moves the carousel to the next or previous row, depending on delta / / Plan: / / Find current Row / / Figure out which row-to-select / / If the row-to-select! = Current Row / / Disable all buttons � � / / Fade out current row / / Make row-to-select the current-row / / Fade in row-to-select / / Enable buttons based on current-row / / Find current row var curRow = findCurrentRow (rowContainer); var indexLastRow = findIndexLastRow (rowContainer); / / Figure out row to select var indexCurRow = parseInt (curRow.attr (“rel”)); var indexRowToSelect = indexCurRow + delta; if (indexRowToSelect indexLastRow) { indexRowToSelect = indexLastRow; } / / Only proceed if there is a possible change if (indexCurRow! = indexRowToSelect) { / / Disable all buttons $ (‘# Btn-prev’). AddClass (“deactivated”); $ (‘# Btn-next’). AddClass (“deactivated”); / / Fade out current row curRow.fadeOut (100, function () { curRow.hide (); / / Make row-to-select the current row / / Remove class ‘on’ rowContainer.children (‘. on’). removeClass (‘on’) / / Add class ‘on’ var rowNext = $ (rowContainer.children () [indexRowToSelect]); rowNext.addClass (‘on’); / / Fade in the new row rowNext.fadeIn (100, function () { rowNext.show (); / / Alert (“index row to select =” ; + indexRowToSelect + “, indexLastRow =” + indexLastRow); / / Enable buttons based on current row var enablePrev = indexRowToSelect! = 0; var enableNext = indexRowToSelect! = indexLastRow; if (enablePrev) { $ (‘# Btn-prev’). RemoveClass (“deactivated”); } if (enableNext) { $ (‘# Btn-next’). RemoveClass (“deactivated”); } }); }); } }}]]>
No comments:
Post a Comment