2012

Rotating Image Banner Added

Article by:
Date Published:
Last Modified:

Finally, a rotating image banner has been added back to CladLabs, just like the one when the website was running of the Drupal CMS. I used the Cimy Header Image Rotator plugin and added code to the header.php file in a child theme for ‘motion’.

Screenshot of the rotating banner added to the CladLabs website.

Screenshot of the rotating banner added to the CladLabs website.

I was having issues with the text element that the Cimy plugin added with the image. The default setting was for the text to be placed in the middle (both vertically and horizontally) of the image, which isn’t very appealing. I wanted the text to span the bottom of the image, and wanted to get rid of the rounded corners of the text box. To do this, I had to edit the generated code as follows (including adding an extra ‘div’ element around the entire plugin). The total size of the rotating header element is 980x300px.

Note that CSS styling is included in this html file, as provided by the generated Cimy code. If I really wanted to do this ‘properly’, I would move the CSS to the style.css file in the same folder.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!-- Code added to header.php in the child theme for motion ('motion-child')
   Added in the header div element below the logo div -->

<!-- Rotating Cimy header banner image. Added by Geo. -->
<div id="extra-cimy-header">
   <div id="cimy_div_id_0">Loading images...
   </div>
   <div class="cimy_div_id_0_caption"></div>
   <style type="text/css">
   #cimy_div_id_0 {
      position: relative;
      float: left;
      margin: 1em auto;
      border: 1px solid #000000;
      width: 980px;
      height: 300px;
   }

   #extra-cimy-header {
      position: relative;
      float: left;
      margin: 0 auto;
      width: 980px;
      height: 300px;
      padding: 0px 0px 30px 0px;
   }

   div.cimy_div_id_0_caption {
      position: absolute; /* Added by Geo */
      /* margin-top: 0px; */
      margin-left: -490px;
      width: 980px;
      text-align: center;
      left: 50%;
      top: 281px;
      padding: 10px 0px;
      background: black;
      color: white;
      font-family: sans-serif;
      border-radius: 0px;
      display: none;
      z-index: 2;
   }
   </style>

   <noscript>
   <div id="cimy_div_id_0_nojs">
      <img id="cimy_img_id" src="/wp-content/Cimy_Header_Images/0/12mhz-crystal-output-when-driven-by-microcontroller.jpg" alt="" />
   </div>
   </noscript>
</div>
<!-- End of rotating banner image -->

Authors

Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Related Content:

Tags

comments powered by Disqus