2012-07-26, 03:12 PM
Lets try some effects with CSS.
1. Image 'Fade on Hover' Effect
You might have seen social buttons (or some images) in websites which are semi-visible but if you mouse over (hover) on the image it goes normal with a smooth 'Fade In' effect.
To do that; locate any image (may say; logo - which is located in header template) in your theme templates. The link should be like:
<img src="images/mytheme/image.png" />
Now bind it into a new id; we call it 'fadehover':
<div id="fadehover"><img src="images/mytheme/image.png" /></div>
Save the template.
Now lets define the ID we have just created. For that, open your global.css and add at the bottom:
Save global.css, done. Now hover your image and see what happens.
Settings:
>> Opacity should be between 0 & 1, 0 is full transparent, 0.5 is semi-transparent, 1 is solid - not transparent.
>> duration is the mili-seconds defining how long the fade animation will take for changing its state.
2. Rollover Slide Effect
We now will learn a cool hover effect with CSS. Using this trick your logo (or orher images, text or about anything) will slide out a little and return back on lost-focus.
Locate your logo in your header template:
<div class="logo">
<a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a>
</div>
Tag with a new ID:
<div class="logo" id="slide">
Now define the newly created ID "slide" in your global.css
Save both header template and global.css.
Hover your logo image (or where you've applied) and see what happens.
1. Image 'Fade on Hover' Effect
You might have seen social buttons (or some images) in websites which are semi-visible but if you mouse over (hover) on the image it goes normal with a smooth 'Fade In' effect.
To do that; locate any image (may say; logo - which is located in header template) in your theme templates. The link should be like:
<img src="images/mytheme/image.png" />
Now bind it into a new id; we call it 'fadehover':
<div id="fadehover"><img src="images/mytheme/image.png" /></div>
Save the template.
Now lets define the ID we have just created. For that, open your global.css and add at the bottom:
#fadehover img {
opacity: .3;
-webkit-transition: opacity;
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 500ms;
}
#fadehover img:hover{
opacity: 1;
-webkit-transition: opacity;
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 500ms;
}
Save global.css, done. Now hover your image and see what happens.
Settings:
>> Opacity should be between 0 & 1, 0 is full transparent, 0.5 is semi-transparent, 1 is solid - not transparent.
>> duration is the mili-seconds defining how long the fade animation will take for changing its state.
2. Rollover Slide Effect
We now will learn a cool hover effect with CSS. Using this trick your logo (or orher images, text or about anything) will slide out a little and return back on lost-focus.
Locate your logo in your header template:
<div class="logo">
<a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a>
</div>
Tag with a new ID:
<div class="logo" id="slide">
Now define the newly created ID "slide" in your global.css
#slide img {
padding-left: 0;
-webkit-transition: all 0.3s ease-in-out;
}
#slide img:hover {
padding-left: 20px;
-webkit-transition: all 0.3s ease-in-out;
}
Save both header template and global.css.
Hover your logo image (or where you've applied) and see what happens.