how to make newsticker sticky while scrolling

Posted in: Newspaper
Post count: 8

Hi

This is my website i am creating. “http://theindiantelegram.com/” I would like to make the newsticker sticky while scrolling. I have tried lot of things but failed. Kindly advice

Post count: 7909

Hi,

The theme doesn’t have an option to make a specific blocks sticky. But a solution is to use do_shortcode function and place the Newsticker in the menu. For example if you use header style 1 – http://screencast.com/t/1DhmWTd8GKhttp://screencast.com/t/G6ZyfzFQSnhttp://screencast.com/t/1rwuAsuGMmE6
Of course enable sticky menu from Theme Panel > Header – http://screencast.com/t/6z8VxLneQe

Thanks!

Post count: 8

Hi this works..thanks for looking into it..But i have another problem now

http://content.screencast.com/users/akopein/folders/Default/media/0cf9cf7d-0714-4b01-9b3f-fc94678e107f/1.png

I had given a background colour and it now overlaps with the newsticker. I would really appreciate if you got any solution for that

Post count: 8

Oh never mind…i solved it by adding some custom JS and CSS.

http://jsfiddle.net/livibetter/HV9HM/

This is really helpful if anyone else wants to make the newsticker sticky

Custom js
jQuery(document).ready(function($) {
function sticky_relocate() {
var window_top = $(window).scrollTop();
var div_top = $('#sticky-anchor').offset().top;
if (window_top > div_top) {
$('#sticky').addClass('stick');
} else {
$('#sticky').removeClass('stick');
}
}

$(function () {
$(window).scroll(sticky_relocate);
sticky_relocate();
console.log("hello");
})
});

Custom CSS:

#sticky.stick {
position: fixed;
top: 100px;
width: 860px;
}

Copy both stuff and place it in the themepanel. Add the following elements anywhere to echo the newsticker

<div id="sticky-anchor"></div>
<div id="sticky">
<?php echo do_shortcode('[td_block_trending_now]');?>
</div>

Post count: 7909

@akopein Thanks for sharing!

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.