Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="cover-image"> <!-- vlad -->
- <?php if ( has_post_thumbnail() ) {
- the_post_thumbnail();
- }?>
- </div>
- <script type='text/javascript'>
- var image = jQuery(".attachment-post-thumbnail").get(-1);
- jQuery(image).hide();
- jQuery(image).load(function() {
- smartcrop.crop(image, {width: parseInt(image.getAttribute("width")), height: '800'}).then(function(result){
- var ratio = result.topCrop.y/image.naturalHeight*100;
- image.style.objectPosition = "50% " + ratio + "%";
- console.log(ratio);
- jQuery(image).fadeIn();
- });
- });
- jQuery('.cover-image').height(jQuery(window).height() * 0.65);
- jQuery(image).closest('.cover-image').append(jQuery(image));
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement