Javascript: Slide Show/contract the effect of the ad code instance, Javascript tutorial
Function Description:
Slide to expand or contract the advertising effect. You can specify the duration and maximum height when the advertisement is fully expanded.
Compatible with browsers:
IE5.0 +, FF1.06 +, and Opera8.0 +
Instance code:
The following is a reference clip: Code example: Slide and expand/Contract ads Var intervalId = null; Function slideAd (id, nStayTime, sState, nMaxHth, nMinHth ){ This. stayTime = nStayTime * 1000 || 3000; This. maxHeigth = nMaxHth | 90; This. minHeigth = nMinHth | 1; This. state = sState | "down "; Var obj = document. getElementById (id ); If (intervalId! = Null) window. clearInterval (intervalId ); Function openBox (){ Var h = obj. offsetHeight; Obj. style. height = (this. state = "down ")? (H + 2): (h-2) + "px "; If (obj. offsetHeight> this. maxHeigth ){ Window. clearInterval (intervalId ); IntervalId = window. setInterval (closeBox, this. stayTime ); } If (obj. offsetHeight Window. clearInterval (intervalId ); Obj. style. display = "none "; } } Function closeBox (){ SlideAd (id, this. stayTime, "up", nMaxHth, nMinHth ); } IntervalId = window. setInterval (openBox, 10 ); } Script
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
- Here is the content in the advertisement
Code example:Slide and expand/Contract adsPlease refresh the page and watch the demo again Script |