2016-10-14 2 views
0

Мы внедрили решение завернуть плитки в продвигаемых ссылках, как описаны в следующей статье:SharePoint 2013: Назначена Ссылка Wrap Плитка

SharePoint 2013: Promoted Links Wrap Tiles

Это хорошо работает для нас, однако теперь мы хотим использовать несколько продвинутых списков ссылок. На странице технологов кто-то уже спрашивает то же, что нам нужно, но ответа пока нет. Я заметил, что мы получаем тот же идентификатор веб-части, что и парень, который имеет тот же запрос, что и WebPartWPQ4.

Переход через скрипт сам я понял, что мне нужно изменить строку, которая находит продвигаемые ссылки пунктов:

var numberOfPromotedLinks = $('.ms-promlink-body > .ms-tileview-tile- root').length; 

Я пытался изменить его так:

var numberOfPromotedLinks = $('#WebPartWPQ4 > .ms-promlink-body > .ms-tileview-tile-root').length; 

Однако это Безразлично Не работай.

ответ

0
  1. Нажмите на зубчатое, Редактировать страницу
  2. Выберите вкладку Вставка
  3. Выберите веб-часть
  4. В Категории колонке - Нажмите СМИ и содержание
  5. В колонке частей - Нажмите Редактор Script
  6. В правая сторона - Нажмите Добавить
  7. В поле «Новый редактор сценариев» (возможно, [2]) щелкните стрелку вниз, которая отображается в правом углу, и нажмите «Редактировать веб-па» к.т..
  8. Затем нажмите появившийся значок EDIT SNIPPET.
  9. Вставьте следующий текст в «Вставить» коробке:
<script type="text/javascript" src="https://code.jquery.com/jquery-1.10.2.min.js "></script> 

<script type="text/javascript"> 
$(document).ready(function() { 

// Update this value to the number of links you want to show per row 

var numberOfLinksPerRow = 3; 

// local variables 

var pre = "<tr><td><div class='ms-promlink-body' id='promlink_row_"; 
var post = "'></div></td></tr>"; 
var numberOfLinksInCurrentRow = numberOfLinksPerRow; 
var currentRow = 1 

// find the number of promoted links we're displaying 
var numberOfPromotedLinks = $('.ms-promlink-body > .ms-tileview-tile-root').length; 

    // if we have more links then we want in a row, let's continue 
    if (numberOfPromotedLinks > numberOfLinksPerRow) { 

    // we don't need the header anymore, no cycling through links 
    $('.ms-promlink-root > .ms-promlink-header').empty(); 

    // let's iterate through all the links after the maximum displayed link 
    for (i = numberOfLinksPerRow + 1; i <= numberOfPromotedLinks; i++) { 

     // if we're reached the maximum number of links to show per row, add a new row 
     // this happens the first time, with the values set initially 
     if (numberOfLinksInCurrentRow == numberOfLinksPerRow) { 

     // i just want the 2nd row to 
     currentRow++; 

     // create a new row of links 
     $('.ms-promlink-root > table > tbody:last').append(pre + currentRow + post); 
     // reset the number of links for the current row 
     numberOfLinksInCurrentRow = 0 } // move the Nth (numberOfLinksPerRow + 1) div to the current table row 

    $('.ms-promlink-body > .ms-tileview-tile-root:nth-child(' + (numberOfLinksPerRow + 1) + ')').appendTo($('#promlink_row_' + currentRow)); 

    // increment the number of links in the current row 
    numberOfLinksInCurrentRow++; } 
} 
}); 
</script>