Jump to content


Photo
- - - - -

positioning of custom script.

CSS script position

  • Please log in to reply
7 replies to this topic

#1 create

create

    Advanced Member

  • Members

  • 41 posts
  • LocationUK
  • Country: Country Flag

Posted 28 September 2012 - 12:30 PM

Take a look at my site

Please Login or Register to see this Hidden Content



I'm trying to change the position of a custom script that I installed into the header scripts. The script displays a custom greeting on the site depending on the time of day. I want the greeting to be above the telephone number in the header but i'm struggling to achieve this.

The script is as follow:

Please Login or Register to see this Hidden Content


Can anyone help?

thanks

James UK

#2 Danny

Danny

    Is Awesome!

  • Moderators
  • 13192 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 28 September 2012 - 12:36 PM

Hi,

You would need to wrap in a div to position it however, Javascript isn't really my forte.

#3 create

create

    Advanced Member

  • Members

  • 41 posts
  • LocationUK
  • Country: Country Flag

Posted 28 September 2012 - 03:47 PM

I have managed to wrap it in a div, but i'm struggling to:

1. bring the div to the front, so it sits on top of the header
2. It's currently set to 50px off the right but its doing this off the side of the browser window, rather than the right hand side of the web page

grateful for any help

#4 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 28 September 2012 - 05:47 PM

1. You may need to adjust the z-index:

Please Login or Register to see this Hidden Content


2. The left/right margins need to be changed:

Please Login or Register to see this Hidden Content



Please see this documentation for further instructions:

Please Login or Register to see this Hidden Content



#5 create

create

    Advanced Member

  • Members

  • 41 posts
  • LocationUK
  • Country: Country Flag

Posted 01 October 2012 - 05:01 PM

thanks for the replies, I have managed to position the div on top now with an outlandish z-index figure of 999. I'm still having trouble with positioning the div above the phone number in the header. The margins seem to be working off the edge of the browser window rather than the edge of the web pages? any ideas how i define that??

#6 Evan Mattson

Evan Mattson

    Super Member

  • Members

  • 196 posts
  • LocationAnn Arbor, MI
  • Framework Version:latest stable & beta releases
  • Country: Country Flag

Posted 02 October 2012 - 01:57 AM

Scripts that output stuff for display on the page like this really don't belong in the headerscripts as it will output in the <head> tag. You're better off adding this code with a php hook in your child theme's functions.php file.

Please Login or Register to see this Hidden Content


That will get you a lot closer to where you want it, and then you won't need such hardcore CSS to wrestle it into place.

Hope that helps :)

#7 create

create

    Advanced Member

  • Members

  • 41 posts
  • LocationUK
  • Country: Country Flag

Posted 02 October 2012 - 02:48 PM

Hi Evan, thanks for your reply.

I added your code to the functions.php file located in /wp-content/themes/pagelines/functions.php

and was returned with the following error when I reloaded the page...

Parse error: syntax error, unexpected '<' in /websites/123reg/LinuxPackage22/ll/oy/ds/lloydspropertyagents.com/public_html/wp-content/themes/pagelines/functions.php on line 24

Any ideas?

thanks

J

#8 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 02 October 2012 - 10:44 PM

Evan didn't point you to the correct functions.php. Please remove the code from where you placed it.

The code he provided should work if you have the pagelines-customize plugin installed. In there, you'll find a functions.php. Just tack his code at the end.

Alternatively, if you're using a child theme, like Base, you can use the functions.php inside the child theme folder.

You'll get errors when using the core files.





Also tagged with one or more of these keywords: CSS, script, position