Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Javascript Help Please

Featured Replies

The following script switches the css so that when the user hovers the mouse over the image the opacity increases and the image changes from b&w to colour. How would i get this transition to happen gradually over a period of time?

 

<script type="text/javascript"> 
<!-- 
function lightup2(obj){
obj.className=(obj.className=='test'?'testHov':'test')
}
//--> 
</script> 

<style type="text/css"> 
.test { 
background-color: #000080; 
color: #FFFFFF; 
font-size: 1.4em; 
width: 14em; 
filter: gray alpha(opacity=40); 
-moz-opacity: .4; 
} 
.testHov { 
background-color: #000080; 
color: #FFFFFF; 
font-size: 1.4em; 
width: 14em; 
filter: alpha(opacity=100); 
-moz-opacity: 1.0; 
} 

</style> 

<div class="test" onmouseover="lightup2(this)" onmouseout="lightup2(this)"><img src="landscape-photo.jpg"></img></div>

 

Many Thanks,

Craig

Off the top of my head I would suggest using JQuery - it has lots of little features like that.

 

I am no JS expert so the best I can do is tell you to go here: Jquery

 

and then check out: Nettuts Screencast on Jquery (Excellent stuff) for details on how to do it :)

 

I hope that helps out mate

  • Author

Many thanks, will try it out a bit later when ive got a spare 5 mins. Dont have a clue about Javascript, its all just a load of code to me (hence why i asked).

Many thanks, will try it out a bit later when ive got a spare 5 mins. Dont have a clue about Javascript, its all just a load of code to me (hence why i asked).

 

If it's just a spot effect one off, I'd just use a library. Animations are not the easiest thing to achieve in JS, not at entry level anyway. If you want to learn JS, I'd say that animation isn't really an entry level area to get started on.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.