Positioning bug solution
-
Hi!
I have discovered your plugin today, as I was trying to inser ta small pop up on the bottom-left part of my site. After I got it, I realized that the pop up was sticking to the left side of my browser, despite the fact that I had set some pixel space at the “Left / Distance from the left edge of the screen.” Item.
I had a look at your code, and found the bug at line 140 & following of file “popup-maker/includes/popup-functions.php”:
if ( ! strpos( $display['location'], 'left' ) ) { unset( $display['position_left'] ); } if ( ! strpos( $display['location'], 'right' ) ) { unset( $display['position_right'] ); } if ( ! strpos( $display['location'], 'top' ) ) { unset( $display['position_top'] ); } if ( ! strpos( $display['location'], 'bottom' ) ) { unset( $display['position_bottom'] ); }The problem was that, my “location” being “left bottom”, the conditions evaluated as “0” for the first “strpos”, “false” for the next two, and “5” for the last one. The problem is that the negation of both “0” and “false” resolve as “true”, triggering the “if” statements, and making my “left” space disappear.
A solution would be changing the code a little bit, to require a strict evalulation of “strpos” as “false” to trigger the “unset” functions.
if ( strpos( $display['location'], 'left' ) === false ) { unset( $display['position_left'] ); } if ( strpos( $display['location'], 'right' ) === false) { unset( $display['position_right'] ); } if ( strpos( $display['location'], 'top' ) === false) { unset( $display['position_top'] ); } if ( strpos( $display['location'], 'bottom' ) === false) { unset( $display['position_bottom'] ); }
The topic ‘Positioning bug solution’ is closed to new replies.