Can the following code be used to compare the value of the "left" attribute?
if ($('.pager').css('left') < 100 + 'px')
Or do I need another code? (My problem is how to deal with 'px' if I have to remove it or at least use it consistently in code.
thank
Just use it parseInt, it will ignore pxfor you:
parseInt
px
if (parseInt($('.pager').css('left')) < 100)
Or you can use the property leftin position():
left
position()
var left = $('.pager').position().left; if (left < 100) // Etc
Consider using a variable.
var pagerPos = parseInt($('.pager').css('left')) if (pagerPos < 100) {...}
, if . parseInt(), "px", CSS. !
.style DOM
.style
document.getElementById("id").style.left
Source: https://habr.com/ru/post/1761104/More articles:what to use in a multi-threaded environment; Vector or ArrayList - javaWhat / How does an animation with a close aperture of UIImagePickerController start? - iphoneHow to make screen capture on a web page / combine 2 images - javascriptConvert Objective-C code to C ++ to determine user downtime in OS X - c ++: dependent =>: destroy does not call the destroy method before deleting? - ruby-on-railsCheck if copy and paste is enabled - javascriptGrouping related constants between classes - javaOrientation Javascript does not work with PhoneGap on iPad - javascriptWorking with iPad orientation in javascript - javascriptGet one accelerometer value - androidAll Articles