Advanced Search

Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Cursor effects

  1. #1
    Join Date
    Jun 2011
    Posts
    38
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Smile Cursor effects

    Hello!
    I have a problem with a script. When I use it on the page ( http://www.souhssz.com/tjestova/question/ ) the main menu disappears. Any idea why?
    This is the code:

    HTML Code:
    <script type='text/javascript'>
    // <![CDATA[
    var colour="#FF0066";
    var sparkles=40;
    var x=ox=400;
    var y=oy=300;
    var swide=800;
    var shigh=600;
    var sleft=sdown=0;
    var tiny=new Array();
    var star=new Array();
    var starv=new Array();
    var starx=new Array();
    var stary=new Array();
    var tinyx=new Array();
    var tinyy=new Array();
    var tinyv=new Array();
    window.onload=function() { if (document.getElementById) {
    var i, rats, rlef, rdow;
    for (var i=0; i<sparkles; i++) {
    var rats=createDiv(3, 3);
    rats.style.visibility="hidden";
    document.body.appendChild(tiny[i]=rats);
    starv[i]=0;
    tinyv[i]=0;
    var rats=createDiv(5, 5);
    rats.style.backgroundColor="transparent";
    rats.style.visibility="hidden";
    var rlef=createDiv(5, 5);
    var rdow=createDiv(5, 5);
    rats.appendChild(rlef);
    rats.appendChild(rdow);
    rlef.style.top="2px";
    rlef.style.left="0px";
    rdow.style.top="0px";
    rdow.style.left="2px";
    document.body.appendChild(star[i]=rats);
    }
    set_width();
    sparkle();
    }}
    function sparkle() {
    var c;
    if (x!=ox || y!=oy) {
    ox=x;
    oy=y;
    for (c=0; c<sparkles; c++) if (!starv[c]) {
    star[c].style.left=(starx[c]=x)+"px";
    star[c].style.top=(stary[c]=y)+"px";
    star[c].style.clip="rect(0px, 5px, 5px, 0px)";
    star[c].style.visibility="visible";
    starv[c]=50;
    break;
    }
    }
    for (c=0; c<sparkles; c++) {
    if (starv[c]) update_star(c);
    if (tinyv[c]) update_tiny(c);
    }
    setTimeout("sparkle()", 40);
    }
    function update_star(i) {
    if (--starv[i]==25) star[i].style.clip="rect(1px, 4px, 4px, 1px)";
    if (starv[i]) {
    stary[i]+=1+Math.random()*3;
    if (stary[i]<shigh+sdown) {
    star[i].style.top=stary[i]+"px";
    starx[i]+=(i%5-2)/5;
    star[i].style.left=starx[i]+"px";
    }
    else {
    star[i].style.visibility="hidden";
    starv[i]=0;
    return;
    }
    }
    else {
    tinyv[i]=50;
    tiny[i].style.top=(tinyy[i]=stary[i])+"px";
    tiny[i].style.left=(tinyx[i]=starx[i])+"px";
    tiny[i].style.width="2px";
    tiny[i].style.height="2px";
    star[i].style.visibility="hidden";
    tiny[i].style.visibility="visible"
    }
    }
    function update_tiny(i) {
    if (--tinyv[i]==25) {
    tiny[i].style.width="1px";
    tiny[i].style.height="1px";
    }
    if (tinyv[i]) {
    tinyy[i]+=1+Math.random()*5;
    if (tinyy[i]<shigh+sdown) {
    tiny[i].style.top=tinyy[i]+"px";
    tinyx[i]+=(i%5-2)/5;
    tiny[i].style.left=tinyx[i]+"px";
    }
    else {
    tiny[i].style.visibility="hidden";
    tinyv[i]=0;
    return;
    }
    }
    else tiny[i].style.visibility="hidden";
    }
    document.onmousemove=mouse;
    function mouse(e) {
    set_scroll();
    y=(e)?e.pageY:event.y+sdown;
    x=(e)?e.pageX:event.x+sleft;
    }
    function set_scroll() {
    if (typeof(self.pageYOffset)=="number") {
    sdown=self.pageYOffset;
    sleft=self.pageXOffset;
    }
    else if (document.body.scrollTop || document.body.scrollLeft) {
    sdown=document.body.scrollTop;
    sleft=document.body.scrollLeft;
    }
    else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
    sleft=document.documentElement.scrollLeft;
    sdown=document.documentElement.scrollTop;
    }
    else {
    sdown=0;
    sleft=0;
    }
    }
    window.onresize=set_width;
    function set_width() {
    if (typeof(self.innerWidth)=="number") {
    swide=self.innerWidth;
    shigh=self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth) {
    swide=document.documentElement.clientWidth;
    shigh=document.documentElement.clientHeight;
    }
    else if (document.body.clientWidth) {
    swide=document.body.clientWidth;
    shigh=document.body.clientHeight;
    }
    }
    function createDiv(height, width) {
    var div=document.createElement("div");
    div.style.position="absolute";
    div.style.height=height+"49px";
    div.style.width=width+"50px";
    div.style.overflow="hidden";
    div.style.backgroundColor=colour;
    return (div);
    }
    // ]]>
    </script>
    Regards!

  2. #2
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    What you posted is not html it is javascript.

    I did see the cursor thing working fine and sourced the page to see what was missing.(personally that is annoying to me and I don't know why someone would want it.But that is my opinion only-lol)

    But I moved the location of the cursor script and this is what I got using Firefox 18.0.2
    http://www.web-user.info/test/cursor/cursor.html
    Thanks,

    Bud

  3. The Following User Says Thank You to ajfmrf For This Useful Post:

    balki (02-15-2013)

  4. #3
    Join Date
    Jun 2011
    Posts
    38
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Default

    I agree about the effect, but it is intended for young children, students, and it is interesting for them.
    The strangest thing is that the same script I'm featured before on another page of the site and work there - http://www.souhssz.com/tjestova/jefjekt-srchitsa
    I tried the script and it works on other sites. Why does not on my site?

  5. #4
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    I don't understand.It is working on the page I made and the menu is clearly visible on the left side.

    Is this not what you want?The script for the cursor is working as well as the menu being there......
    Thanks,

    Bud

  6. #5
    Join Date
    Jun 2011
    Posts
    38
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Default

    I gave two links, both with same script:
    http://www.souhssz.com/tjestova/question - no menu
    http://www.souhssz.com/tjestova/jefjekt-srchitsa - with menu
    I see that on your website it works, but on first link my menu missing

  7. #6
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    All you need to do is move the javascript for the hearts cursor out of the widget div and put it in the head of the page like I did here:

    http://www.web-user.info/test/cursor/question.html

    Code:
    <div class="rbcWidgetArea" style="text-align: center;"><script type="text/javascript" src="http://www.souhssz.setra.icnhost.net/p/heart.js"></div>
    					</div><!-- / id="mainZone" class="colA" -->
    
    I moved the highlighted line to the head section(source my page to see) and left  the div empty.
    					<!-- / CENTER ZONE ~ MAIN -->
    Thanks,

    Bud

  8. The Following User Says Thank You to ajfmrf For This Useful Post:

    balki (02-16-2013)

  9. #7
    Join Date
    Jun 2011
    Posts
    38
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Default

    Well, that explains the problem. I have no rights to write in the head part.
    The main menu disappears when I use an external host.
    On the webpage http://www.souhssz.com/tjestova/jefjekt-srchitsa/ I put the whole script from the first post in the topic.
    Now, when I use the same technique, cursor effect does not work on different page - http://www.souhssz.com/tjestova/question/ and I don't know why?
    Last edited by balki; 02-16-2013 at 08:43 AM. Reason: grammar

  10. #8
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    I did not see the cursor's 'hearts.js' file when I sourced your page.

    Did you forget to add it to the different page?

    After I posted I went and checked it out.You did indeed forget the cursor script in the "different" page.I uploaded the different page and when I added the hearts.js script to it it worked fine.

    http://www.web-user.info/test/cursor/different.html
    Thanks,

    Bud

  11. The Following User Says Thank You to ajfmrf For This Useful Post:

    balki (02-17-2013)

  12. #9
    Join Date
    Jun 2011
    Posts
    38
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Default

    It is difficult to understand each other
    Currently on my two pages I dont use http://www.souhssz.setra.icnhost.net/p/heart.js I use the script from the first post which I set with embed option. The mystery is why on a first page script is executed, but on other is not running?

    Regards!

  13. #10
    Join Date
    Jan 2011
    Location
    Southeastern CT
    Posts
    586
    Thanks
    41
    Thanked 27 Times in 27 Posts

    Default

    Now you are confusing me.

    Post each page and what is wrong with either page.If it is okay note the page as being ok but also note which one is not working like you want.We will need to do this t see what is what
    Thanks,

    Bud

Similar Threads

  1. IE 8 and Image Effects
    By brianscook in forum JavaScript
    Replies: 1
    Last Post: 10-27-2008, 01:17 PM
  2. cursor effects...how do I get it to show
    By atomicsloth in forum HTML
    Replies: 3
    Last Post: 05-29-2008, 01:03 AM
  3. Replies: 3
    Last Post: 01-28-2008, 06:42 AM
  4. link effects?
    By xoblivionxfantasyx in forum HTML
    Replies: 2
    Last Post: 04-21-2006, 10:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •