jQuery hover and class selector

后端 未结 10 1778
半阙折子戏
半阙折子戏 2020-12-10 00:56

I wan\'t to change the background color of a div dynamicly using the following HTML, CSS and javascript. HTML:


      
      
10条回答
  •  长情又很酷
    2020-12-10 01:19

    If someone reads the original question to mean that they want to dynamically change the hover css and not just change the base css rule for the element, I've found this to work:

    I have a dynamically loaded page that requires me to find out how high the container becomes after data is loaded. Once loaded, I want to change the hover effect of the css so that an element covers the resulting container. I need to change the css .daymark:hover rule to have a new height. This is how...

    function changeAttr(attrName,changeThis,toThis){
        var mysheet=document.styleSheets[1], targetrule;
        var myrules=mysheet.cssRules? mysheet.cssRules: mysheet.rules;
    
        for (i=0; i

提交回复
热议问题