Support Forums
Need help getting a better method to do this. - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Webmaster Support (https://www.supportforums.net/forumdisplay.php?fid=36)
+---- Forum: Website Development (https://www.supportforums.net/forumdisplay.php?fid=43)
+---- Thread: Need help getting a better method to do this. (/showthread.php?tid=26462)



Need help getting a better method to do this. - Mark Topper - 06-07-2012

Greetings.


I was thinking if it somehow was possible to replace this code with a better code.


My current code:
Code:
<!-- Count Scroll Start -->
        <div id="scroll">
            <a href="#" onclick="this.innerHTML='You have scrolled <span id=pixels>0</span> Pixels.';">
                <img src="images/blank.png" width="10" height="10" alt="" />
            </a>
</div>
    <!-- Count Scroll End -->


What it does:
Currently it change the image into a text.


What I don't like about it:
I don't like that it comes instantly on the page, it would be nice if it somehow could fade in.
But what is the most annoying is that it jumps to the top of the page when I click on it.


Demo:
http://www.marktopper.dk/goo/
NOTE: Up in the top-left corner I have a transpirant image (size 10x10 pixels) which you can click on to se this.


Does anyone have any ideas for a better method to do this?


RE: Need help getting a better method to do this. - 'Snorlax - 07-14-2012

Try looking into this script:
PHP Code:
<html>
<
head>
<
script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
<
script type="text/javascript">
function 
onloadFunct(){
$(
"#lol").fadeIn(1400);
}
</
script>
</
head>
<
body onclick="javascript: onloadFunct();">
<
p style="display: none;" id="lol">some text</p>
</
body>
</
html

Should be 'pretty' simple Smile