1

Is there a way for me to detect if the style attribute of a class changes, for example, a change in display or visibility?

The situation I have is that I have a Podio webform embedded on my site via iframe and that has a hidden thank you message in .webforms__success-message > p and I want to scroll to the success message when it appears on the page.

Sandra Willford
  • 3,459
  • 11
  • 49
  • 96

1 Answers1

0

I would recommend VueJS instead of jQuery. It's faster because it uses a virtual dom and it doesn't have to traverse the dom in order to detect changes. You simply create an action and then emit that action as an event. Then you can call whichever jQuery functions you would like.

<div id="app">
   <iframe v-show="isShowing" src="http://www.weather.gov/" 
        frameborder="0"
        ></iframe>
  <button @click="isShowing ^= true">Click Me</button>
</div>

CSS

iframe {
  display:block;
  margin-top: 20px;
  margin-left: 200px;
  width:850px;
  height:300px;
}

JS

var vue = new Vue({
  el:"#app",
  data: {
    isShowing:false,
  }
})

check out this Codepen

Miguel Coder
  • 1,896
  • 19
  • 36