Ilya Man
Ilya Man

Reputation: 11

jQuery can't select element in iframe

I use Visual Composer plugin in WP theme. Parallax scrolling works well on frontend, but when I changing page with VC frontend editor parallax scrolling is not working, and some other jQuery code also.

how can I fix it?

Upvotes: 0

Views: 1437

Answers (2)

hitesh upadhyay
hitesh upadhyay

Reputation: 264

if you want to get element within iframe, you have to use "contents()" feature of jquery :

$( "#iframe" ).contents().find( "div" ).each(function(){
   // your function goes here
})

Upvotes: 0

Adnan Ahmed
Adnan Ahmed

Reputation: 686

Assign your frame an id and then in the find element add your element id.

$('#iframe_id').contents().find('iframe').contents().find('#element');

Upvotes: 1

Related Questions