简体   繁体   中英

Missing drawing pop-up

I want to draw some pop-up in a predefined range in horizontal scroll but it does not appear in browser, wath is wrong?

$(function(){ $(window).scroll(function(){

       var popID
       var range = $(this).scrollLeft();
       switch (range) {
           case (>500 && <600):
               popID='popup1';
               break;  
       }
$('#' + popID).fadeIn().css({ 'width': String( popWidth ),'height':String(popHeight )  })
  .prepend('<a href="#" class="close"><img src="close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>');

   });

});

switch(range) {
    case ( > 500 && < 600):

This does not do what you think it does.

if( range > 500 && range < 600)

'width': String(popWidth),
'height': String(popHeight)

width:123 is NOT valid CSS (or rather, it was, but it's not anymore) because lengths must have a unit.

'width': popWidth+"px",
'height': popHeight+"px"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM