Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Template.ImageT.onRendered(
- function(){
- $main = $('#main');
- $main.children('.thumb').each(function(){
- var $this = $(this),
- $image = $this.find('.image'), $image_img = $image.children('img'),
- x;
- // No image? Bail.
- if ($image.length == 0)
- return;
- // Image.
- // This sets the background of the "image" <span> to the image pointed to by its child
- // <img> (which is then hidden). Gives us way more flexibility.
- // Set background.
- $image.css('background-image', 'url(' + $image_img.attr('src') + ')');
- // Set background position.
- if (x = $image_img.data('position'))
- $image.css('background-position', x);
- // Hide original img.
- $image_img.hide();
- console.log("IMG HIDDEN")
- });
- console.log("Ran this!");
- });
Add Comment
Please, Sign In to add comment