Jump to content

Eyad Syria-lover

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by Eyad Syria-lover

  1. Scratch that! Better solution as the if condition won't activate clearInterval() as 'r_start', 'g_start', 'b_start' remain the same value (so it will run continuously even though rgb() will stop incrementing when rgb(255,255,255) is reached, its still looping), in the else condition all you need is

    r_start = r_start + 1;
    g_start = g_start + 1;
    b_start = b_start + 1;
    var i = r_start, j = g_start, k = b_start;
    element.style.backgroundColor = "rgb(" + i + "," + j + "," + k + ")";
    

    or remove var i, j, and k completly from background styling, and use 'r_start', 'g_start', 'b_start' instead

     

    In Fact I'am Kind Of Lost.

    Can You Provide Me With A Code Sir?...

    I Mean A Modified Copy Of My Code...

  2. Hello There.

    I'am Making What It Seems Like A Function To Animate The Background Color Of An Element,But I Have A Problem.

    This Is The Code:

     

    <script>

    function color(id,duration,r_start,g_start,b_start,r_end,g_end,b_end)

    {

    var element=document.getElementById(id);

     

    var parameter=setInterval(colorGradually,50*duration);

     

    function colorGradually()

    {

    if (r_start==r_end && g_start==g_end && b_start==b_end)

    {

    clearInterval(parameter);

    }

    else

    {

    for (var i=r_start,var j=g_start,var k=b_start;

    i<r_end && j<g_end && k<b_end;i++,j++,k++)

    {

    element.style.backgroundColor="rgb("+i+","+j+","+k+")";

    }

    }

     

    }

     

     

    }

    </script>

    <div id="test" style="width:100%;height:200px;background-color:rgb(128,128,128)"></div>

    <input type="button" onclick="color('test',1,128,128,128,255,255,255)" value="Change">

     

    The Script Isn't Working At All.

    I've Checked The Script With Esprisma Code Validator And The Code Was Syntactically Valid,But I Can't Recognize The Problem...

  3. Use text input, with anchor element, or input type button, or button element, when any of these are clicked disable default action (go to href url link, submit etc), get text input value and use as argument used as keyword of function.

    I'am Sorry Sir,Maybe I've Asked In Such A Way That Was In-Appropriate.

    How Can I Pass A Variable In A Regular Expression?

  4. So,I'am Creating An Internal Search Engine Which Can Be Used To Search For A Specific Word In The Page You're Browsing.

    This Engine Makes The Background Color Is Yellow For The Word You're Searching.

     

    <!--Taken From W3Schools.com-->

     

    <p>

    The display property sets or returns the element's display type.

     

    Elements in HTML are mostly "inline" or "block" elements: An inline element has floating content on its left and right side. A block element fills the entire line, and nothing can be displayed on its left or right side.

    </p>

     

    <p>

    The display property also allows the author to show or hide an element. It is similar to the visibility property. However, if you set display:none, it hides the entire element, while visibility:hidden means that the contents of the element will be invisible, but the element stays in its original position and size.

     

    Tip: If an element is a block element, its display type can also be changed with the float property.

    </p>

     

    <script>

    var i;

    function searchFor(keyword)

    {

    for (i=0;i<document.querySelectorAll("p").length;i++)

    {

    document.querySelectorAll("p").innerHTML=document.querySelectorAll("p").innerHTML.replace(/keyword/gi,"<span style='background-color:yellow;'>"+keyword+"</span>");

    }

     

     

    searchFor("display");

     

    </script>

     

    How Can I Make It Possible To Pass A String As A Parameter To The searchFor() Function?

  5. In Fact,You Can Run JavaScript In Several Ways,You Can Create A Script Directly In Your Page Or Embed It From External Source Using The <script> Tag,Or You Can Add It Inline Using Events Like "onclick",So Actually There Is No Difference.

    • Like 1
  6. If you care about compatibility with older browsers, you can use Date() objects. It has millisecond precision, but you can benchmark code by running it thousands of times.

    var iterations = 100000;
    
    var start = (new Date()).getTime();
    for(var i = 0; i < iterations; i++) {
      // Put code here for benchmarking
    }
    var end = (new Date()).getTime();
    
    // Find out how long it took
    var elapsedTime = end - start;
    
    // Find out how much time passes for just one function call
    var averageTime =  elapsedTime / iterations;
    
    // Output data
    console.log(averageTime);

    This Is Taking More Than Expected Because The Iteration Is Very Big,Do You Have Another Way Sir?

  7. you are missing a lot of information that would be really helpful. What about it isn't working? What are you expecting vs what is actually happening? What version of jQuery and jQuery mobile are you using? Are you checking for any errors in the browser's console? What have you tried?

    Sir I'am Using jQuery Mobile 1.4.5 With jQuery 1.12.4 .

    I'am Making A Popup And I Have Inserted A Select Menu Inside It,I've Also Used The data-native-menu="false" Attribute In Order To Use The Custom Dropdown From jQuery Mobile,So I'am Expecting To Use This Custom Dropdown,But When I Try It,It Shows Me The Default Dropdown (That One Which Is Generated By The Platform).

    I'am Not Getting Any Errors In The Browser's Console,I've Tried To Change The jQuery Version But That Didn't Work For Me.

  8. HI,

    i have no good enough of the knowledge about the CSS design,

    i try to making the effect like Facebook, when mouse enter the people name will pop-up a small box , displaying like the people name,profile image,background image , and other 3 button in footer.

    i try to made it but still fail .... i dont have idea how to make a picture in-between the background image and some simple description.

    is not mistaken been using the CSS change the profile image position to absolute, and i guess the z-index also need higher of number ....

    but those of the design ... i not design similar like the facebook....or else other webpage same as the effect but the profile image show in center instead on the left side ....

    have any one can make a example or sample to teaching me how to do that ...

    thanks all for you help and in the end ...sorry for my english are not very well, i hope you understand what i mean

    Thanks

    Sir You Can Do The Popup Effect Easily By Using CSS Display Property.

    First You Should Use The :hover Selector In CSS (I'am Assuming That You Have No Idea About JavaScript).

    You Should Create A Hidden Small-Box For Every Person You Have:

     

    .person-panel

    {

    display:block;

    width: /* Enter The Panel's Width Here */;

    height:/* Enter The Panel's Height Here*/;

    }

     

    Now You Have To Use The :hover Selector As Following:

     

    .person-panel:hover

    {

    display:block;

    }

×
×
  • Create New...