javascript - jquery - colorbox - adding a function to the popup -


i have "quick view" feature captures dynamic url known "qvurl" , creates colorbox via:

    <script type="text/javascript">     $(function(){         $(".quickview_btn").click(function(e){             e.preventdefault();             var qvurl = $(this).attr("href");             $.colorbox({"href": qvurl})         });         $.colorbox.resize();     }); </script> 

now. need make changes in child window - seems ajax or whatever wiping out entire dom , load parent window doesn't reflect.

for instance - let's want add div says qwerty! [i'm wanting create mbox around call action]

any insight appreciated!

please note - urls it's loading content can not manipulate - has done in parent window.

thanks!

please see below full snippet:

<script> $( document ).ready(function() {    $('.quickview_btn').click(function(){       //quickview tracking   $('.quickview').attr('id', 'quickviewclicked-area');    mboxdefine('quickviewclicked-area','quickviewclicked','clicked=y');  $( 'div.quickview' ).bind( 'click', function() {   console.log('clicked!');   product = $(this).children().attr('href');   console.log(product)      mboxupdate('quickviewclicked', "link="+product);    });    //thumbnail add cart tracking     $('div.add-to-cart').attr('id', 'thumbnailaddtocart-area');  mboxdefine('thumbnailaddtocart-area','thumbnailaddtocartclicked','clicked=y');  $( 'div.qlbtns' ).bind( 'click', function() { ;       mboxupdate('thumbnailaddtocartclicked', "clicked=y");       console.log('mbox updated!') });   });  });  /*  $(document).ready(function(){         $(qvurl).$colorbox({             iframe : true,             frastiframe: false,             oncomplete: function(){                 $('.name').html('yeah got it');             }         });     });     */ </script> 

< script >    $(document).ready(function() {        $('.quickview_btn').click(function() {              //quickview tracking        $('.quickview').attr('id', 'quickviewclicked-area');          mboxdefine('quickviewclicked-area', 'quickviewclicked', 'clicked=y');          $('div.quickview').bind('click', function() {          console.log('clicked!');          product = $(this).children().attr('href');          console.log(product)            mboxupdate('quickviewclicked', "link=" + product);        });              //thumbnail add cart tracking                $('div.add-to-cart').attr('id', 'thumbnailaddtocart-area');          mboxdefine('thumbnailaddtocart-area', 'thumbnailaddtocartclicked', 'clicked=y');          $('div.qlbtns').bind('click', function() {;              mboxupdate('thumbnailaddtocartclicked', "clicked=y");          console.log('mbox updated!')        });          });      });    /*   $(document).ready(function(){          $(qvurl).$colorbox({              iframe : true,              frastiframe: false,              oncomplete: function(){                  $('.name').html('yeah got it');              }          });      });  	*/  < /script>

i see line in code:

  $.colorbox({"href": qvurl}) 

and first question whether or not selector enough. mind more middle-ware client-side guru, knowledge of jquery, selector won't because jquery can't tell mean. see how used quotes in assignment of click function?

 $(".quickview_btn").click(function(e){         e.preventdefault(); 

if used $("#colorbox") object (if id) or $(".colorbox" if is a class targeting. (i not expert, said, agree:

$(".someclass") selects elements class name someclass $("#testbutton") selects element id value of testbutton 

-- courtesy of dzone jquery ref card @ https://dzone.com/refcardz/jquery-selectors

so may else fine, aren't passing code hook colorbox object.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -