עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

תצוגה בהתאם לגודל מסך ע"י ג'אווה סקריפט

Featured Replies

פורסם

ערב טוב.

מישהו יודע אולי איך אני יכול לעשות לגודמא 3 סוגי תצודה באתר וקוד ג'אווה סקריפט(לדוג', לא חייב דווקא ג'אווה סקריפט) יבדוק מה גודל המסך ויבחר איזה תצוגה לשים.

תודה רבה ושבוע טוב.

פורסם

לא כלכך הבנתי מה הכוונה ב"3 סוגי תצוגה", אבל בעיקרון אתה יכול לזהות את רוחב המסך עם הפונקציה הנחמדה הזאת:

<script type="text/javascript">
function getRealWidth()
{
var myWidth = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
}

return myWidth;
}

myWidth = getRealWidth();
</script>

ואז כמובן לעשות מה שבא לך עם המידע הזה..

פורסם
  • מחבר

אני די מתחיל בעניני ג'אווה סקריפט ובניית אתרים בכלל.

אשמח לדעת איך אני משתמש בקוד.

תודה רבה.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.