Skip to content

Instantly share code, notes, and snippets.

@jdaly13
Created September 4, 2013 22:54
Show Gist options
  • Save jdaly13/6443911 to your computer and use it in GitHub Desktop.
Save jdaly13/6443911 to your computer and use it in GitHub Desktop.
start of replacement for marvel module
var relatedProductsContainer = $("#relatedProducts");
relatedProductsContainer.find('article').each(function(index, element) {
var containerHeight = []
var $element = $(element);
var liFirstChild = $element.find('div.product_content ul.product_description_list li:first-child');
var liLastChild = $element.find('div.product_content ul.product_description_list li:last-child');
var liOnlyChild = $element.find('div.product_content ul.product_description_list li:only-child');
var liSpanElement = liFirstChild.children('span:first-child');
var lastLiSpanElement = liLastChild.children('span');
var more = $('<a class="more_or_less more" style="cursor:pointer">more</a>'); //more trigger
var less = $('<a class="more_or_less less" style="cursor:pointer">less</a>'); //less trigger
more.insertAfter(liSpanElement);
less.insertAfter(lastLiSpanElement);
containerHeight[index] = $element.eq(index).outerHeight();
console.log(containerHeight);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment