This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

CSS Spin
#4
Hello admin,

Fan Didn't Spin in the first time, after second change or browser refresh it become ok!

here is the JS I used:
Code:
// Spin/High Speed Fan


$(function(){
  if (window.grp) {
    function listen(i) {
      grp.listen('1/7/' + i, function(object) {
          $('.spin-animation.item-read-only')
                    .removeClass('item-read-only')
                    .css('pointer-events', 'none');
          $('.spin-' +i).toggleClass('spin-animation', object.value == true);
      });
    }
   
    for (var i = 1; i <= 40; i++) {
      listen(i);
    }
  }
});

Another issue I faced:
I used This Rotate JS Code:
Code:
// Rotate
$(function(){
  $('[class*=rotate-]').each(function(index, el) {
    var match = el.className.match(/rotate\-(\d+)/);
    el.style.transform = 'rotate(' + match[1] + 'deg';
  });
});

But I added another JS Code to Enable/Disable read only property, Because these objects controlled by Motion sensors but I want to give the user control in case of Motion failure.
But when objects changed to Read only by the following JS; rotate malfunction
 
Code:
$(function(){
   grp.listen('50/5/21', function(object) {
      if (object.value == true ) {
         $(".lockbyknx").addClass("item-read-only");
      } else if (object.value == false ) {
         $(".lockbyknx").removeClass("item-read-only");
      }
   });
});
Best Regards,
Reply


Messages In This Thread
CSS Spin - by khalil - 05.09.2022, 10:21
RE: CSS Spin - by admin - 05.09.2022, 10:26
RE: CSS Spin - by khalil - 05.09.2022, 10:34
RE: CSS Spin - by khalil - 11.09.2022, 08:45
RE: CSS Spin - by admin - 12.09.2022, 12:00
RE: CSS Spin - by khalil - 12.09.2022, 14:13
RE: CSS Spin - by admin - 13.09.2022, 09:55
RE: CSS Spin - by khalil - 14.09.2022, 06:51

Forum Jump: