Solved

how to centre Js script on my website

Posted on 2011-09-12
12
317 Views
Last Modified: 2012-05-12
I have the following code using lightbox.

<script src="http://gettopup.com/releases/latest/top_up-min.js" type="text/javascript">
</script>
<div style="text-align: center">

</div>

<div id="examples">
<input class="tu_iframe_800x2000" href="http://astore.amazon.com/daveknowsall-20" type="button" value="Amazon Store Click Here" /></div>
<script type="text/javascript">
      TopUp.addPresets({
        "#examples a": {
          effect: "clip"
        },
        "#examples input": {
          shaded: 1, effect: "fade", overlayClose: 1
        }
      });
    
</script>

Open in new window

I would like to know how to get this to open on the centre of my website. Because currently it opening far right. I have tried adding a "align =centre" but doesnt seem to work.

If some has a better suggection for a java lightbox script let me know.

My website i am using this on is
http://www.toocoolfor.tv/p/amazon-store.html

Rrgds
Kepners
0
Comment
Question by:kepners
  • 7
  • 5
12 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 250 total points
ID: 36526578
The size of your iframe is 800 x 957
So replace :  <input class="tu_iframe_800x2000" href="http://astore.amazon.com/daveknowsall-20" type="button" value="Amazon Store Click Here" />
by : <input class="tu_iframe_800x957" href="http://astore.amazon.com/daveknowsall-20" type="button" value="Amazon Store Click Here" />

If you want to look to other easy to use lightboxes, check the following links :

http://fancybox.net/
http://bitbonsai.com/facybox/
https://github.com/defunkt/facebox
http://orangoo.com/labs/GreyBox/
0
 

Author Comment

by:kepners
ID: 36527736
hi ya,

thank you for the reply. That only made the lightbox smaller.

When i open the lightbox. Sometimes it openes it square on with the store showing then closes, then flicks it all the way to the top left and shows a black window. other times it pull it to the left and it black a black window. USed in IE8

in Firefox it opens all the way to the right - but everything else is ok.

Now, interestingly, i have the same coding on my other site www.alderaan.tv and it works perefectly. I have a feeling its to do with the layout of my toocoolfor.tv site - but whats from i dont know. I am sure that i tried changing the layout on toocoolfor.tv and it didnt work properly then.

Any further thoughts.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36532149
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:kepners
ID: 36532620
thank you Leakim971 but that reply doesnt help me as i am not good enough at coding to be able to go though all of that. Plus its basically a blogger.com template. so any error as such are not of my making. I am looking for help help sorting the coding out. thank you for the imput though.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36533204
ok, I will try to debug it, just replace top_up-min.js by top_up.js (download the file if you don't have it and put it on your site in the same folder)
0
 

Author Comment

by:kepners
ID: 36534215
Hi leakin971. I'll try that when I get to work. I have te same site at www.alderaan.tv. And it doesn't seem to have the same issues. There is only minor difference like a different background photo and some advertising widgets. Do you think it could be my custom background on toocoolfor.tv screwing it up? Or one of the widgets? Or should none of these factors matter and it's something else?

Going back to the different script I'll mail you again when I have done it. Cheers for your help

Keps
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36535250
If the box is not centered it's because the code get the wrong width, it don't get the right one, so it do some centering with a wrong width, a lower width, the box go to the right
0
 

Author Comment

by:kepners
ID: 36538353
hi Leakim971.

That made no difference. Is there a progam that show you what driving this? or something to make it jump far right or absolut right. Maybe there is a way to put a code to make this jump to centre because align-centre isnt working

KKeps
0
 

Assisted Solution

by:kepners
kepners earned 0 total points
ID: 36538598
I have worked it out!!! it the was outside element of the POLL that was screwing it up. I went through ever element testing them between the real site and a test site. The poll screw it up. i have removed it and BOOM it works normally thank you for your help my friend.
0
 

Author Closing Comment

by:kepners
ID: 36558797
I solve it myself. Brilliant thou
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36538780
you're the best ;)) !!!
0
 

Author Comment

by:kepners
ID: 36538800
I know, you get all the points and i solved it. i dont care you made me think about it etc. Plus this place is really good - shame you dont have a BLOGGER tag anymore. anyway! cheers my friend.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
The Enter button on the keyboard 5 328
Ajax contents 13 287
I.E. 9 JQuery Menu disapears when page is refreshed? 3 104
Is there a way I can make this alert a little more pretty? 6 141
Is your phone running out of space to hold pictures?  This article will show you quick tips on how to solve this problem.
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question