PDA

View Full Version : Stay on Top Content Script - Center?



fergusonkw
06-30-2009, 04:38 PM
1) Script Title: Stay On Top Content Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/stayontop.htm

3) Describe problem: I cannot seem to get my div element to center itself on the page. I'm aware that there's 4 options to position the element based on the 4 corners of the window. However I'm hoping to be able to horizontally center it on the page and am wondering if there's a way to do this.

I've tried using CSS position elements within the DIV tag when it's created, but the javascript positioning functions seem to override it.

Please help

ddadmin
06-30-2009, 07:58 PM
Sure, try the following modified .js file. It adds a 5th orientation type that centers the DIV on the page. Just use a value of 5 below:


alwaysOnTop.init({
targetid: 'examplediv',
orientation: 5,
position: [5, 10],
fadeduration: [1000, 1000],
frequency: 0.95,
hideafter: 15000
})

fergusonkw
07-02-2009, 01:42 PM
That actually worked perfectly once I 'commented' out the vertical positioning in the 'if' statement.

Thanks for your help!

kolenoblata
12-03-2010, 05:39 AM
I would like to show ad to each user only once per 24h. I try to add "frequency: 1 day" or "frequency: 1 days" but it doesn't work.


Thanks

jscheuer1
12-03-2010, 09:11 AM
That would be:


frequency: '1 days'

Example:


alwaysOnTop.init({
targetid: 'examplediv',
orientation: 3,
position: [5, 10],
fadeduration: [1000, 1000],
frequency: '1 days',
hideafter: 15000
})

kolenoblata
12-03-2010, 09:22 AM
Oh, yes, I forgot to add quotes :)

Thanks

wads24
05-26-2013, 11:28 AM
Sure, try the following modified .js file. It adds a 5th orientation type that centers the DIV on the page. Just use a value of 5 below:


alwaysOnTop.init({
targetid: 'examplediv',
orientation: 5,
position: [5, 10],
fadeduration: [1000, 1000],
frequency: 0.95,
hideafter: 15000
})
This did not work for me. Anyone else know how to center it?

jscheuer1
05-26-2013, 01:27 PM
This is an old thread. The script itself may have changed. Please start a new thread for a new question.

But before doing so, make sure you are also using the modified script from ddadmin's post.